Content testing method, system, device, and medium

By slicing and detecting response information in real time during the streaming output of the language model, the problem of long content detection time in the prior art is solved, realizing the real-time and accuracy of streaming output and avoiding the presentation of inappropriate content.

WO2026016553A1PCT designated stage Publication Date: 2026-01-22BEIJING ZITIAO NETWORK TECH CO LTD +1
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/088310
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-07-19
Filing Date
2025-04-10
Publication Date
2026-01-22

AI Technical Summary

Technical Problem

In existing technologies, the process of digital assistants generating response information and then performing content detection is time-consuming, making it difficult to guarantee the real-time nature of content detection, which may result in inappropriate content being presented to the user.

Method used

During the process of streaming response information from the language model, content slices are determined by a set sampling strategy, and a content detection model is used for real-time detection to ensure that the detection is performed before the output content and to avoid the presentation of inappropriate content.

Benefits of technology

It enables real-time content detection during streaming, reducing user waiting time, improving the accuracy and real-time performance of content detection, and preventing the presentation of inappropriate content.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025088310_22012026_PF_FP_ABST
    Figure CN2025088310_22012026_PF_FP_ABST
Patent Text Reader

Abstract

The present disclosure provides a content testing method, a system, a device, and a medium. The content testing method comprises: continuously receiving output content outputted by a language model by streaming means; on the basis of a set sampling policy, determining a content slice from the output content that has been outputted; performing content testing on the content slice, to obtain a test result of the content slice; transmitting the output content which has undergone content testing to a client, so that the output content is displayed on the client in a streaming output mode. In the content testing method, in the process of the language model performing content output by streaming output means, "testing during output" can be implemented, improving the real-time performance of content testing.
Need to check novelty before this filing date? Find Prior Art

Description

Content inspection methods, systems, equipment and media

[0001] This application claims priority to Chinese Patent Application No. 202410978396.0, filed on July 19, 2024, the disclosure of which is incorporated herein by reference in its entirety. Technical Field

[0002] This disclosure relates to a content inspection method, system, electronic device, and computer-readable storage medium. Background Technology

[0003] With the rapid development of computer technology, digital assistants have emerged. Users can interact with digital assistants through human-computer dialogue. Specifically, users can input questions into the digital assistant, which can then analyze the questions and generate responses, thus achieving human-computer dialogue.

[0004] Typically, considering the length of the response message, digital assistants can use streaming output to deliver the content and transmit it to the client in a streaming manner, thus avoiding long waiting times for users.

[0005] In related technologies, to avoid inappropriate content (such as content that is not intended to be presented to the user) in response messages, content detection can be performed on the response messages after they are generated. However, the content detection process described above takes a long time from response message generation to content detection completion, making it difficult to guarantee the real-time nature of content detection. Summary of the Invention

[0006] This disclosure provides a content detection method. This method enables content detection during the streaming output of response information from a language model, improving the real-time performance of content detection. This disclosure also provides systems, electronic devices, computer-readable storage media, and computer program products corresponding to the above method.

[0007] Firstly, this disclosure provides a content detection method, the method comprising:

[0008] Continuously receive the output content of the language model streaming;

[0009] Based on the set sampling strategy, content slices are determined from the output content that has already been output;

[0010] Perform content detection on the content slice to obtain the detection result of the content slice;

[0011] The content-inspected output content is transmitted to the client so that the output content is displayed on the client in a streaming manner.

[0012] In some possible implementations, determining content slices from the output content according to a set sampling strategy includes:

[0013] Based on a set sliding window and / or a set step, a content slice is determined from the output content; wherein the sliding window is used to determine the number of reply characters in the content slice, and the step is used to determine the difference between two adjacent content slices detected.

[0014] In some possible implementations, determining content slices from the output content based on a set sliding window and / or a set step size includes:

[0015] According to the set step, the sliding window moves backward in the character sequence by a set amount; wherein, the character sequence consists of multiple reply characters from the output content that has already been output;

[0016] In response to the number of reply characters in the sliding window reaching the length of the sliding window, the reply characters in the sliding window are identified as content slices.

[0017] In some possible implementations, the method further includes:

[0018] In response to the language model starting to stream the output content, the position of the sliding window in the character sequence is determined to be the beginning of the character sequence;

[0019] In response to the number of reply characters in the sliding window reaching a first preset length, the reply characters in the sliding window are determined as the content slice for the first content detection, wherein the first preset length is less than the length of the sliding window.

[0020] In some possible implementations, after completing the first content detection, the method further includes:

[0021] Maintain the position of the sliding window within the character sequence;

[0022] In response to the number of reply characters in the sliding window reaching the length of the sliding window, the reply characters in the sliding window are identified as content slices for the second content detection.

[0023] In some possible implementations, the step of performing content detection on the content slice to obtain the detection result of the content slice includes:

[0024] The content slice is input into the content detection model, and the detection results output by the content detection model are received; wherein, the content detection model has natural language analysis capabilities.

[0025] In some possible implementations, the method further includes:

[0026] Based on the detection results of the content slice, a processing strategy for the content slice is determined; wherein the processing strategy includes at least one of the following: a strategy for instructing the language model whether to continue streaming the output content, a strategy for instructing whether to present the output content, and a strategy for instructing the presentation of the content.

[0027] In some possible implementations, the detection result indicates that the content slice has passed content detection, and determining the processing strategy for the content slice based on the detection result includes:

[0028] Instruct the language model to continue streaming the output content; and,

[0029] The client is instructed to display a target response character on the dialogue page; wherein the dialogue page is used to interact with the digital assistant, and the target response character is a response character in the content slice that is not displayed on the dialogue page.

[0030] In some possible implementations, the detection result indicates that the content slice has failed content detection, and the step of determining a processing strategy for the content slice based on the detection result includes:

[0031] Instruct the language model to stop streaming the output content; and,

[0032] The client is instructed to replace the reply characters already displayed on the chat page with default characters.

[0033] Secondly, this disclosure provides a content detection system, the system comprising:

[0034] The receiving module is used to continuously receive the output content of the language model streaming output;

[0035] The determination module is used to determine content slices from the output content according to the set sampling strategy;

[0036] The detection module is used to perform content detection on the content slice and obtain the detection result of the content slice;

[0037] A transmission module is used to transmit the content-inspected output content to the client so that the output content is displayed on the client in a streaming manner.

[0038] In some possible implementations, the determining module is specifically used for:

[0039] Based on a set sliding window and / or a set step, a content slice is determined from the output content; wherein the sliding window is used to determine the number of reply characters in the content slice, and the step is used to determine the difference between two adjacent content slices detected.

[0040] In some possible implementations, the determining module is specifically used for:

[0041] According to the set step, the sliding window moves backward in the character sequence by a set amount; wherein, the character sequence consists of multiple reply characters from the output content that has already been output;

[0042] In response to the number of reply characters in the sliding window reaching the length of the sliding window, the reply characters in the sliding window are identified as content slices.

[0043] In some possible implementations, the determining module is further configured to:

[0044] In response to the language model starting to stream the output content, the position of the sliding window in the character sequence is determined to be the beginning of the character sequence;

[0045] In response to the number of reply characters in the sliding window reaching a first preset length, the reply characters in the sliding window are determined as the content slice for the first content detection, wherein the first preset length is less than the length of the sliding window.

[0046] In some possible implementations, after completing the first content detection, the determining module is further configured to:

[0047] Maintain the position of the sliding window within the character sequence;

[0048] In response to the number of reply characters in the sliding window reaching the length of the sliding window, the reply characters in the sliding window are identified as content slices for the second content detection.

[0049] In some possible implementations, the detection module is specifically used for:

[0050] The content slice is input into the content detection model, and the detection results output by the content detection model are received; wherein, the content detection model has natural language analysis capabilities.

[0051] In some possible implementations, the determining module is further configured to:

[0052] Based on the detection results of the content slice, a processing strategy for the content slice is determined; wherein the processing strategy includes at least one of the following: a strategy for instructing the language model whether to continue streaming the output content, a strategy for instructing whether to present the output content, and a strategy for instructing the presentation of the content.

[0053] In some possible implementations, the detection result indicates that the content slice has passed content detection, and the determining module is specifically used for:

[0054] Instruct the language model to continue streaming the output content; and,

[0055] The client is instructed to display a target response character on the dialogue page; wherein the dialogue page is used to interact with the digital assistant, and the target response character is a response character in the content slice that is not displayed on the dialogue page.

[0056] In some possible implementations, the detection result indicates that the content slice has failed content detection, and the determining module is specifically used for:

[0057] Instruct the language model to stop streaming the output content; and,

[0058] The client is instructed to replace the reply characters already displayed on the chat page with default characters.

[0059] Thirdly, this disclosure provides an electronic device including a processor and a memory. The processor and the memory communicate with each other. The processor is configured to execute instructions stored in the memory to cause the electronic device to perform a content detection method as described in the first aspect or any implementation thereof.

[0060] Fourthly, this disclosure provides a computer-readable storage medium storing instructions that instruct an electronic device to perform the content detection method described in the first aspect or any implementation thereof.

[0061] Fifthly, this disclosure provides a computer program product containing instructions that, when run on an electronic device, causes the electronic device to execute the content detection method described in the first aspect or any implementation thereof.

[0062] Based on the implementation methods provided in the above aspects, this disclosure can be further combined to provide more implementation methods. Attached Figure Description

[0063] To more clearly illustrate the technical methods of the embodiments of this disclosure, the accompanying drawings used in the embodiments will be briefly described below.

[0064] Figure 1 is a schematic flowchart of a content detection method provided in an embodiment of this disclosure;

[0065] Figure 2 is a flowchart illustrating another content detection method provided in an embodiment of this disclosure;

[0066] Figure 3 is a schematic diagram of the structure of a content detection system provided in an embodiment of this disclosure; and

[0067] Figure 4 is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation

[0068] The terms "first" and "second" used in the embodiments of this disclosure are for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature.

[0069] First, some technical terms involved in the embodiments of this disclosure will be introduced.

[0070] With the rapid development of computer technology, digital assistants have emerged. Digital assistants typically possess natural language processing capabilities. In some examples, users can interact with them through human-computer dialogue. For instance, a user can input a question related to general knowledge into the digital assistant, and the assistant, by analyzing the user's input, can generate a response to that question, thus completing a dialogue. In other examples, the digital assistant can process natural language content according to the user's needs. For instance, a user can input a text and instruct the assistant to perform related processing (such as summarizing the text). By recognizing the user's needs, the digital assistant can summarize the input text and generate a response that includes the summarized content.

[0071] Considering that response messages can be quite long, the digital assistant can output content in a streaming manner and transmit the output to the client in a streaming fashion. That is, the digital assistant can output content character by character, one character at a time, until all characters are output, forming the complete response message. Furthermore, during the streaming process, response characters are continuously transmitted to the client. For example, when a certain number of response characters are reached, that number is transmitted to the client. Alternatively, response characters output within a certain transmission interval are transmitted to the client. In this way, the client can see the digital assistant's output in real time via streaming, without waiting for the digital assistant to generate a complete response message, thus avoiding excessive user waiting time and improving the user's interactive experience with the digital assistant.

[0072] Digital assistants typically generate responses based on the natural language processing capabilities of language models. However, due to the large and complex corpora used to train these language models (i.e., training data), it is difficult to ensure that the responses generated by digital assistants fully meet user needs.

[0073] In related technologies, to avoid inappropriate content in response messages, such as content that is not intended to be presented to the user, content detection is usually required. Specifically, after the digital assistant generates the response message, the response message can be divided into multiple segments, and content detection can be performed using preset detection rules or keyword matching rules. However, the above content detection methods are performed after the complete response message is generated, and response messages containing inappropriate content may have already been presented to the user, making it difficult to guarantee the real-time nature of content detection.

[0074] In view of this, the present disclosure provides a content detection method. The method continuously receives the output content of the language model streaming output, determines content slices from the output content according to a set sampling strategy, then performs content detection on the content slices to obtain the detection results of the content slices, and transmits the content-detected output content to the client so that the output content is displayed on the client in a streaming output manner.

[0075] In this method, while the language model is outputting content in a streaming manner, the output content is continuously received. By using a set sampling strategy, the output content is sliced. In this way, there is no need to wait for all the response information to be generated before detection, realizing "detection while outputting" and improving the real-time performance of content detection.

[0076] To facilitate understanding of the technical solutions provided in the embodiments of this disclosure, the following description will be provided in conjunction with the accompanying drawings.

[0077] Referring to Figure 1, a flowchart illustrating a content detection method provided in this embodiment of the present disclosure is shown. This method can be executed by a server for performing content detection, and specifically includes:

[0078] S101: Continuously receive the output content of the language model streaming output.

[0079] In this embodiment of the disclosure, a user can engage in human-computer dialogue with a digital assistant. In some embodiments, the digital assistant can be a standalone software system; for example, it can be an application (APP) with human-computer dialogue capabilities. In other embodiments, the digital assistant can be a functional module of other systems; for example, it can be deployed within a business platform to provide human-computer dialogue functionality as a functional module of the platform. In still other embodiments, the digital assistant may also support online use.

[0080] Digital assistants typically offer a dialog box where users can interact with them. Specifically, the dialog box provides input fields and message sending controls. Users can enter requests in the input fields, such as questions or processing needs for text content. After the user completes their request, the message sending control is triggered, sending the request to the digital assistant and displaying it in the dialog box.

[0081] Depending on the application scenario, the dialog window can have different forms. In some embodiments, the digital assistant is a standalone software system, in which case the dialog window can be a page loaded in the digital assistant's client. In other embodiments, the digital assistant can be a functional module of another system, in which case the dialog window can be a page loaded in the client of that other system. In still other embodiments, the digital assistant supports online use, and the dialog window can be a page displayed in a browser.

[0082] In some possible implementations, digital assistants can generate response information based on the natural language processing capabilities of a language model. This language model possesses natural language processing (NLP) capabilities, enabling it to handle different types of natural language tasks. For example, the language model could be a deep learning model trained using text data.

[0083] In other words, after a user sends a request, the digital assistant can call a language model to process the request. The language model analyzes the request, identifies the user's intent in the human-computer dialogue, and then generates a response to the request. This completes one round of human-computer dialogue.

[0084] The following describes the specific process of generating response information using a language model. Language models are typically generative models, and the process of generating response information can include multiple output rounds. Each output round outputs a response character (token), and the new response character depends on the request information and the response characters generated in previous output rounds.

[0085] In other words, in the first output round, the language model outputs the first response character based on the request information. In the Nth output round, the language model generates the Nth response character based on the request information and the N-1 response characters output in the previous N-1 output rounds. Here, N is an integer greater than 1. Thus, after all output rounds have been completed, the response characters output in each output round constitute the response information output by the language model.

[0086] In this embodiment, the language model outputs content in a streaming manner, and the server for content detection continuously receives the streaming output from the language model. In other words, the digital assistant invokes the language model to output a response character in each output round and sends the output content, including the response character, to the server for content detection. Thus, the server for content detection continuously receives the output from the language model in units of response characters, performing content detection on the output content before presenting the response information to the user.

[0087] S102: Determine content slices from the output content according to the set sampling strategy.

[0088] Specifically, the content slice includes at least one reply character. In this embodiment of the disclosure, the content slice can be understood as the detection object in content detection; that is, content detection can be performed on at least one reply character in the content slice.

[0089] A sampling strategy can be understood as a strategy used to determine content slices from the output content. Since the language model uses a streaming output method, generating one response character per output round, the server used for content detection needs to determine the content slices to be detected from the output content (including multiple response characters) already output by the language model using a certain sampling strategy.

[0090] In some possible implementations, leveraging the characteristics of streaming output from language models, the server-side for content detection can determine content slices using a sliding window and a step size. Specifically, content slices are determined from the output content based on a set sliding window and / or a set step size.

[0091] A sliding window can be used to process subsequences within a data sequence. It maintains a fixed-length window, sliding across the data sequence, and the data within the window forms subsequences. The stride can be understood as the step size by which the sliding window slides across the data sequence.

[0092] In this embodiment of the disclosure, the data sequence may refer to a character sequence composed of multiple response characters in the output content already output by the language model. In other words, according to the order of the output rounds, the response characters output by the language model in each output round are arranged into a character sequence.

[0093] Furthermore, the sliding window can be used to determine the number of response characters in a content slice, and the step size can be used to determine the difference between two adjacent content slices detected. In other words, by sliding the sliding window across the character sequence, the content slices for multiple content detections are determined during the process of the language model generating response information, achieving "detection while outputting".

[0094] In practice, the server used for content detection can move a set sliding window backward in the character sequence according to the set step. When the number of reply characters in the sliding window reaches the length of the sliding window, the reply characters in the sliding window are identified as content slices.

[0095] In other words, in this embodiment of the disclosure, the number of response characters in a single content detection satisfies the length of the sliding window. For example, when the length of the sliding window is 500 characters, the number of response characters in the content slice is 500. Subsequent content detection will then target these 500 response characters. The difference between the content slices of two adjacent content detections is the number of response characters for the step length. For example, when the step length is 20 characters, if the content slice of the Nth content detection includes characters 301 to 800 in the character sequence, the content slice of the (N+1)th content detection includes characters 321 to 820 in the character sequence.

[0096] This can be understood as follows: because the language model continuously generates response characters using a streaming output method, after moving the sliding window forward at a set step length, the sliding window may exceed the range of the character sequence. That is, the number of response characters in the sliding window may be less than the length of the sliding window. For example, if the sliding window length is 500 characters and the step length is 20 characters, after moving forward 20 characters in the character sequence, the number of output response characters included in the sliding window is only 480, which is less than the length of the sliding window. As the server used for content testing continuously receives the output content streamed from the language model, the length of the character sequence increases accordingly. When the number of response characters in the sliding window reaches 500, these 500 response characters are used as a content slice.

[0097] Therefore, this embodiment of the disclosure, taking into account the characteristics of streaming output from the language model, slices the generated response characters by moving a sliding window step-by-step during the process of generating response information, thereby determining the detection objects for multiple content detections. Furthermore, since the output content of the language model typically represents natural language content, this embodiment of the disclosure ensures that the content slices of two adjacent content detections include some of the same response characters by moving the sliding window step-by-step. This avoids lower accuracy in subsequent content detections due to inaccurate character segmentation or semantic incoherence.

[0098] Furthermore, in response to the language model starting to stream the output content, the position of the sliding window in the character sequence is determined to be the beginning of the character sequence. In response to the number of reply characters in the sliding window reaching a first preset length, the reply characters in the sliding window are determined as the content slice of the first content detection.

[0099] The first preset length is less than the length of the sliding window. For example, the first preset length can be the length of the step.

[0100] In other words, when the language model begins generating response information, the character sequence does not yet include the output response characters. The initial position of the sliding window is set to the beginning of the character sequence, and the first content slice is determined after the language model generates response characters of the first preset length. In this way, the first content detection is performed after a relatively short waiting period.

[0101] Taking the first preset length as the step length as an example, when the step length is 20 characters, the position of the sliding window is at the beginning of the character sequence. After the language model outputs the 20th reply character, the 1st reply character to the 20th reply character is determined as the content slice of the first content detection.

[0102] Furthermore, after completing the first content detection, the position of the sliding window in the character sequence is maintained, and in response to the number of reply characters in the sliding window reaching the length of the sliding window, the reply characters in the sliding window are determined as the content slices for the second content detection.

[0103] In other words, the first content slice includes a small number of response characters of a first preset length. After the first content detection is completed, the sliding window does not move backward, and continues to wait for the language model to output content until the number of output response characters reaches the length of the sliding window. Then, the response characters of the sliding window length are used as the second content slice.

[0104] For example, the first preset length is the length of the step. When the length of the step is 20 characters and the length of the sliding window is 500 characters, the content slice of the first content detection includes the first reply character to the 20th reply character. After the language model streams the output to the 500th reply character, the first reply character to the 500th reply character is determined as the content slice of the second content detection.

[0105] Thus, in the early stages of the response generation process, the response characters are sliced ​​by first waiting for the language model to output response characters of the step length without moving the sliding window, and then waiting for the language model to output response characters of the sliding window length. In the subsequent content detection, the response characters are sliced ​​by sliding the window backward and waiting for the number of response characters in the sliding window to reach the sliding window length.

[0106] As can be seen from the above, in this embodiment, the determination process of content slices is related to the length and step length of the sliding window. Therefore, users can configure the length and step length of the sliding window themselves. In other words, users can configure the corresponding length and step length of the sliding window based on actual business scenarios to meet the content detection needs of different business scenarios and improve flexibility.

[0107] S103: Perform content detection on the content slices and obtain the detection results of the content slices.

[0108] In this embodiment of the disclosure, content detection of content slices can be used to detect whether there is inappropriate or unwanted content in the content slices. Specifically, the server used for content detection can input the content slices into the content detection model and receive the detection results output by the content detection model.

[0109] The content detection model has natural language processing capabilities; for example, it can be a natural language analysis model. By invoking the content detection model and utilizing its natural language processing capabilities, it is determined whether a content segment passes content detection.

[0110] Compared to keyword matching methods in related technologies, content detection models can accurately detect content based on richer features such as the semantics of reply characters in content slices, thereby improving the accuracy of content detection and reducing false positives and false negatives.

[0111] It should be noted that the embodiments disclosed herein do not limit the specific methods of content detection. In some possible implementations, content detection of content slices can also be achieved by using set content detection rules or other methods.

[0112] In this embodiment of the disclosure, by determining content slices, performing content detection on the content slices, determining content slices again, and performing content detection on the content slices again, multiple content detections are performed during the process of the language model generating response information, thereby meeting the real-time content detection requirements in streaming responses.

[0113] S104: Transmit the content-inspected output content to the client so that the output content is displayed on the client in a streaming manner.

[0114] In this embodiment of the disclosure, the output content of the language model is also transmitted to the digital assistant's client in a streaming manner. Thus, while the language model is generating response information, the digital assistant's client can present the output content to the user in a streaming manner, achieving "output and presentation simultaneously" and reducing the user's waiting time.

[0115] Furthermore, in this embodiment, the output content undergoes content inspection before being transmitted to the digital assistant's client. In other words, output content that has not undergone content inspection will not be transmitted to the client or presented to the user. This avoids presenting the user with output content that includes inappropriate information.

[0116] Furthermore, in some embodiments, the server used for content detection can also determine a processing strategy for the content slices based on the detection results.

[0117] The processing strategy may include at least one of the following: a strategy for instructing the language model whether to continue streaming the aforementioned output content, a strategy for instructing whether to present the output content, and a strategy for instructing whether to present the content.

[0118] In other words, after the server-side component used for content detection determines the content detection result, it can use the result to decide whether the language model should continue to respond to the user's request, whether the current output content should be presented to the user, and whether the presented content should be processed.

[0119] As shown in Figure 2, when the detection result indicates that the content slice has passed content detection, the server used for content detection can instruct the language model to continue streaming the aforementioned output content, and instruct the client to present the target reply character in the dialog page. The target reply character is the reply character in the content slice that is not presented in the dialog page.

[0120] Understandably, since the language model outputs content in a streaming manner, and the output content is transmitted to the digital assistant's client in a streaming manner, in this embodiment of the disclosure, the content slices of two adjacent content detections may include the same reply characters. For example, the content slice of the Mth content detection is the 21st to the 520th reply character, and the content slice of the (M+1)th content detection is the 41st to the 540th reply character, where the 41st to the 520th reply characters are the same reply characters. At this time, if the Mth detection result indicates that the content slice passes the content detection, the dialog page can display the 1st to the 520th reply characters. If the (M+1)th detection result indicates that the content slice passes the content detection, then the target reply characters are the 521st to the 540th reply characters.

[0121] Thus, if no inappropriate content is included in the content slice, the language model is instructed to output subsequent reply characters normally, and the client is instructed to present the output content to the user normally.

[0122] When the detection result indicates that the content slice fails the content detection, the language model is instructed to stop streaming the aforementioned output content, and the client is instructed to replace the response characters already displayed on the dialog page with default characters.

[0123] In other words, when inappropriate content is included in a content slice, the language model is instructed to stop generating subsequent response characters and end the current human-computer dialogue. Furthermore, to avoid presenting inappropriate content to the user, the content displayed on the dialogue page is promptly replaced; for example, the default message could be, "I can't answer this question right now, try asking another one."

[0124] It should be noted that other methods can also be used in this disclosure to avoid presenting inappropriate content to users. For example, keywords in inappropriate content can be replaced with default words, or inappropriate content can be presented with an asterisk (*). This disclosure does not limit this approach.

[0125] In some possible implementations, the number of reply characters in the sliding window may not reach the length of the sliding window. For example, the sliding window is 500 characters long, and the current reply characters in the sliding window are 490 characters long, but the reply information has already been generated. To address this, embodiments of this disclosure provide two different processing modes: In some embodiments, the server used for content detection can default to passing the reply characters in the sliding window, achieving a more lenient content detection. In other embodiments, the server used for content detection may not perform content detection on the reply characters in the sliding window. In this way, the reply characters in the sliding window will not be presented to the user, avoiding the presentation of inappropriate content and achieving a more stringent content detection.

[0126] Based on the above description, this disclosure provides a content detection method. The method continuously receives the output content streamed from a language model, determines content segments from the output content according to a set sampling strategy, performs content detection on the content segments to obtain the detection results, and transmits the content-detected output content to a client so that the output content is displayed in a streaming manner on the client.

[0127] In this method, while the language model is outputting content in a streaming manner, the output content is continuously received. By using a set sampling strategy, the output content is sliced. In this way, there is no need to wait for all the response information to be generated before detection, realizing "detection while outputting" and improving the real-time performance of content detection.

[0128] The content detection method provided by the embodiments of this disclosure has been described in detail above with reference to Figures 1 and 2. The system and device provided by the embodiments of this disclosure will be described below with reference to the accompanying drawings.

[0129] Referring to the structural diagram of the content detection system shown in Figure 3, the system 30 includes:

[0130] The receiving module 301 is used to continuously receive the output content of the language model streaming output, the output content including multiple reply characters;

[0131] The determining module 302 is used to determine content slices from the output content according to the set sampling strategy;

[0132] The detection module 303 is used to perform content detection on the content slice and obtain the detection result of the content slice;

[0133] The transmission module 304 is used to transmit the content-inspected output content to the client so that the output content is displayed on the client in a streaming manner.

[0134] In some possible implementations, the determining module 302 is specifically used for:

[0135] Based on a set sliding window and / or a set step, a content slice is determined from the output content; wherein the sliding window is used to determine the number of reply characters in the content slice, and the step is used to determine the difference between two adjacent content slices detected.

[0136] In some possible implementations, the determining module 302 is specifically used for:

[0137] According to the set step, the sliding window moves backward in the character sequence by a set amount; wherein, the character sequence consists of multiple reply characters from the output content that has already been output;

[0138] In response to the number of reply characters in the sliding window reaching the length of the sliding window, the reply characters in the sliding window are identified as content slices.

[0139] In some possible implementations, the determining module 302 is further configured to:

[0140] In response to the language model starting to stream the output content, the position of the sliding window in the character sequence is determined to be the beginning of the character sequence;

[0141] In response to the number of reply characters in the sliding window reaching a first preset length, the reply characters in the sliding window are determined as the content slice for the first content detection, wherein the first preset length is less than the length of the sliding window.

[0142] In some possible implementations, after completing the first content detection, the determining module 302 is further configured to:

[0143] Maintain the position of the sliding window within the character sequence;

[0144] In response to the number of reply characters in the sliding window reaching the length of the sliding window, the reply characters in the sliding window are identified as content slices for the second content detection.

[0145] In some possible implementations, the detection module 303 is specifically used for:

[0146] The content slice is input into the content detection model, and the detection results output by the content detection model are received; wherein, the content detection model has natural language analysis capabilities.

[0147] In some possible implementations, the determining module 302 is further configured to:

[0148] Based on the detection results of the content slice, a processing strategy for the content slice is determined; wherein the processing strategy includes at least one of the following: a strategy for instructing the language model whether to continue streaming the output content, a strategy for instructing whether to present the output content, and a strategy for instructing the presentation of the content.

[0149] In some possible implementations, the detection result indicates that the content slice has passed content detection, and the determining module 302 is specifically used for:

[0150] Instruct the language model to continue streaming the output content; and,

[0151] The client is instructed to display a target response character on the dialogue page; wherein the dialogue page is used to interact with the digital assistant, and the target response character is a response character in the content slice that is not displayed on the dialogue page.

[0152] In some possible implementations, the detection result indicates that the content slice has failed content detection, and the determining module 302 is specifically used for:

[0153] Instruct the language model to stop streaming the output content; and,

[0154] The client is instructed to replace the reply characters already displayed on the chat page with default characters.

[0155] The content detection system 30 according to the embodiments of this disclosure can correspond to the execution of the methods described in the embodiments of this disclosure, and the above and other operations and / or functions of each module / unit of the content detection system 30 are respectively to implement the corresponding processes of each method in the embodiments shown in FIG1 or FIG2. For the sake of brevity, they will not be described again here.

[0156] This disclosure also provides an electronic device. Specifically, this electronic device is used to implement the functions of the content detection system 30 shown in the embodiment of FIG3.

[0157] Figure 4 provides a schematic diagram of the structure of an electronic device 400. As shown in Figure 4, the electronic device 400 includes a bus 401, a processor 402, a communication interface 403, and a memory 404. The processor 402, the memory 404, and the communication interface 403 communicate with each other via the bus 401.

[0158] Bus 401 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of representation, only one thick line is used in Figure 4, but this does not indicate that there is only one bus or one type of bus.

[0159] The processor 402 can be any one or more of the following processors: central processing unit (CPU), graphics processing unit (GPU), microprocessor (MP), or digital signal processor (DSP).

[0160] Communication interface 403 is used for communication with external devices. For example, communication interface 403 can be used to communicate with a terminal.

[0161] Memory 404 may include volatile memory, such as random access memory (RAM). Memory 404 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).

[0162] The memory 404 stores executable code, and the processor 402 executes the executable code to perform the aforementioned content detection method.

[0163] Specifically, in implementing the embodiment shown in FIG3, and where each module or unit of the content detection system 30 described in FIG3 is implemented by software, the software or program code required to execute the functions of each module / unit in FIG3 can be partially or entirely stored in the memory 404. The processor 402 executes the program code corresponding to each unit stored in the memory 404 to execute the aforementioned content detection method.

[0164] This disclosure also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that a computing device can store, or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive). The computer-readable storage medium includes instructions that instruct the computing device to perform the file processing method described above for the content inspection system 40.

[0165] This disclosure also provides a computer program product comprising one or more computer instructions. When the computer instructions are loaded and executed on a computing device, all or part of the processes or functions described in this disclosure are generated.

[0166] The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, or data center to another website, computer, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means.

[0167] When the computer program product is executed by a computer, the computer performs any of the aforementioned file processing methods. The computer program product can be a software installation package; when any of the aforementioned file processing methods is required, the computer program product can be downloaded and executed on the computer.

[0168] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0169] The units described in the embodiments of this disclosure can be implemented in software or hardware. The names of the units / modules do not necessarily limit the specific unit itself.

[0170] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.

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

[0172] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the systems or apparatus disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and relevant parts can be referred to the method section.

[0173] It should be understood that in this disclosure, "at least one item" means one or more, and "more than one" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.

[0174] It should also be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0175] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.

[0176] The above description of the disclosed embodiments enables those skilled in the art to make or use this disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this disclosure. Therefore, this disclosure is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for content detection, comprising: continuously receiving an output content of a language model streaming output; determining a content slice from the output content that has been output according to a set sampling strategy; performing content detection on the content slice to obtain a detection result of the content slice; transmitting the content slice that has been subjected to content detection to a client to enable the output content to be displayed in a streaming manner at the client.

2. The method of claim 1, wherein, The determining of the content slice from the output content that has been output according to a set sampling strategy comprises: determining the content slice from the output content that has been output according to a set sliding window and / or a set step; wherein the sliding window is used to determine the number of reply characters in the content slice, and the step is used to determine the difference between content slices of two adjacent content detections.

3. The method of claim 2, wherein, The determining of the content slice from the output content that has been output according to a set sliding window and / or a set step comprises: moving a set sliding window backward in a character sequence according to a set step; wherein the character sequence is composed of a plurality of reply characters in the output content that has been output; in response to the number of reply characters in the sliding window reaching the length of the sliding window, determining the reply characters in the sliding window as the content slice.

4. The method of claim 3, further comprising: in response to the language model starting to stream the output content, determining the position of the sliding window in the character sequence to be the front end of the character sequence; in response to the number of reply characters in the sliding window reaching a first preset length, determining the reply characters in the sliding window as the content slice of the first content detection, wherein the first preset length is less than the length of the sliding window.

5. The method of claim 4, wherein, After the first content detection is completed, the method further comprises: maintaining the position of the sliding window in the character sequence; in response to the number of reply characters in the sliding window reaching the length of the sliding window, determining the reply characters in the sliding window as the content slice of the second content detection.

6. The method according to any one of claims 1 to 5, wherein, The performing of content detection on the content slice to obtain a detection result of the content slice comprises: inputting the content slice into a content detection model to receive a detection result output by the content detection model; wherein the content detection model has natural language analysis capability.

7. The method of any one of claims 1-6, further comprising: determining a processing strategy for the content slice according to the detection result of the content slice; wherein the processing strategy comprises at least one of the following: a strategy for indicating whether the language model continues to stream the output content, a strategy for indicating whether to present the output content, and a strategy for indicating to present content.

8. The method of claim 7, wherein, The detection result characterizes that the content slice passes content detection, and the determining of the processing strategy for the content slice according to the detection result of the content slice comprises: indicating the language model to continue to stream the output content; and, indicating the client to present a target reply character in a conversation page; wherein the conversation page is used for interacting with a digital assistant, and the target reply character is a reply character in the content slice that is not presented in the conversation page.

9. The method of claim 7, wherein, The detection result represents that the content slice fails the content detection, and the processing strategy for the content slice is determined according to the detection result of the content slice, including: indicating the language model to stop streaming the output content; and indicating the client to replace the presented reply character in the conversation page with a default character.

10. A content detection system, comprising: a receiving module configured to continuously receive output content streamed by a language model; a determining module configured to determine a content slice from the output content that has been output according to a set sampling strategy; a detecting module configured to perform content detection on the content slice to obtain a detection result of the content slice; a transmitting module configured to transmit the content-detected output content to a client to enable the output content to be displayed in a streaming manner at the client.

11. An electronic device, comprising a processor and a memory, wherein: the processor is configured to execute instructions stored in the memory, so that the electronic device performs the content detection method according to any one of claims 1 to 9.

12. A computer-readable storage medium comprising instructions, wherein, the instructions instruct the electronic device to perform the content detection method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • E-commerce customer service question answering method and device, equipment and medium

    CN117131180A

  • Large-scale language model generation answer reliability detection method

    CN117390409A

  • Content detection method, system, equipment and medium

    CN118982019A

  • Systems and methods for determining and using semantic relatedness to classify segments of text

    US20210279420A1

  • Answer generation method and apparatus based on artificial intelligence, and computer device and medium

    WO2022105122A1