Sensitive word filtering method based on large model streaming data

By forwarding the reply content generated by the big model to the sensitive word filtering service and end users in the streaming data, and performing sensitive word verification in the streaming data, the problem of sensitive word filtering of large model streaming data in the existing technology increases the waiting time for users, and efficient sensitive word filtering and interactive experience are achieved.

CN119597795APending Publication Date: 2025-03-11SICHUAN CHANGHONG ELECTRIC CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411669287.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-21
Publication Date
2025-03-11

AI Technical Summary

Technical Problem

The existing large-model streaming data sensitive word filtering method will increase the user's waiting time and affect the interactive experience.

Method used

Through the management service, the reply content generated by the big model is forwarded to the sensitive word filtering service and the terminal user with streaming data. The terminal user displays the reply content in real time. The sensitive word filtering service caches and uses punctuation marks as separate marks. The cached reply content is divided into fields waiting for sensitive word verification, and the sensitive word verification is performed on the fields waiting for sensitive word verification. After the verification is completed, the fields that have been verified in the cached reply content are cleared. If there are sensitive words in the cached reply content, a second request is sent to the management service, terminate the forwarding of the streaming data and forward the bottom-up content data to the terminal user.

Benefits of technology

The parallel processing of sensitive word verification and terminal user display reply content is realized, avoiding the problem of sensitive word filtering increasing the waiting time for users and improving the interactive experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119597795A_ABST
    Figure CN119597795A_ABST
Patent Text Reader

Abstract

The invention provides a sensitive word filtering method based on large model streaming data, and relates to the technical field of generation of reply content by a large model, reply content generated by the large model is forwarded to a sensitive word filtering service and a terminal user in the form of streaming data through a management service, and the terminal user continuously receives a data packet and displays the reply content. And the sensitive word filtering service continuously receives the data packets, caches the data packets, obtains cached reply contents, verifies the sensitive words, and sends a second request to the management service if the reply contents are verified to have the sensitive words, and the management service receives the second request, stops forwarding the streaming data and forwards bottom content data corresponding to the sensitive words to the terminal user. According to the method, the terminal user replaces the displayed content with the bottom content, so that the sensitive word verification and the terminal user display reply content are processed in parallel, the problem that the waiting time of the user can be increased by the existing large model streaming data sensitive word filtering is solved, and the method is suitable for the sensitive word filtering of the large model streaming data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of large-model generated reply content, and in particular to a sensitive word filtering method based on large-model streaming data. Background Art

[0002] With the continuous development of big model technology and semantic models, the content generated by big models is becoming more and more accurate, and there are more and more applications based on big models. Since big models cannot ensure that the generated replies do not contain sensitive words during training, sensitive word filtering is required for the replies generated by big models.

[0003] Although the big model improves the interactive experience with users, if the original http request method is used, it takes a long time to wait for the big model to be generated before returning the result. Therefore, we choose to use streaming data to send the results, so that users can get the first data packet returned by the big model in almost the same time as the original request method. While not increasing the user interaction waiting time, it greatly improves the interactive effect in the chat field.

[0004] However, when using streaming data to return results, the large model will return text content with random character lengths. If the model is segmented finely enough, the effective text length in each data packet is only 1 to 2 words. If it is necessary to filter sensitive words for the content of each packet returned by the large model, for a long text, dozens of calls to the sensitive word filtering method will greatly reduce the efficiency. If the content returned by the large model is cached locally, the effective content in multiple data packets is concatenated to a certain length and then filtered for sensitive words before being sent down, which will also increase the user's waiting time and affect the user's interactive experience. Summary of the invention

[0005] The technical problem solved by the present invention is to provide a sensitive word filtering method based on large model streaming data, so as to solve the problem that the existing sensitive word filtering of large model streaming data will increase the waiting time of users.

[0006] The present invention solves the above technical problems by adopting a technical solution: a sensitive word filtering method based on large model streaming data, comprising the following steps:

[0007] S1. The terminal user connects to the management service through the connection channel and sends a first request to the management service;

[0008] S2. The management service determines the scenario according to the first request, obtains the scenario corresponding to the first request, and calls the corresponding big model to generate reply content according to the scenario;

[0009] S3. The management service forwards the reply content to the sensitive word filtering service and the terminal user in the form of streaming data, wherein the streaming data includes a plurality of continuous data packets;

[0010] S4, the terminal user continues to receive data packets and displays the reply content in real time; the sensitive word filtering service continues to receive data packets, caches them, obtains the cached reply content, and uses punctuation marks in the reply content as separators to divide the cached reply content into fields waiting for sensitive word verification, and performs sensitive word verification on the fields waiting for sensitive word verification. After the verification is completed, the verified fields in the cache are cleared, and if the cached reply content is verified to contain sensitive words, a second request is sent to the management service;

[0011] S5. After receiving the second request, the management service stops forwarding the streaming data and forwards the backup content data corresponding to the sensitive word to the terminal user;

[0012] S6. After receiving the backup content data, the terminal user replaces the displayed content with the backup content.

[0013] Furthermore, the link channel includes websocket.

[0014] Furthermore, the data packet includes an identifier, and the identifier is used to determine the terminal user and the order of the data packets.

[0015] Furthermore, the second request includes the catch-all content data corresponding to the sensitive word and the identifier.

[0016] Furthermore, the sensitive word check is performed on the fields waiting for sensitive word check using the hanlp dictionary.

[0017] Furthermore, the catch-all content includes: if sensitive words are involved, please try to generate again.

[0018] The beneficial effects of the present invention are as follows: the present invention provides a sensitive word filtering method based on large model streaming data, wherein the reply content generated by the large model is forwarded to the sensitive word filtering service and the terminal user in the form of streaming data through the management service, the terminal user continuously receives the data packet and displays the reply content in real time, the sensitive word filtering service continuously receives the data packet, caches it, obtains the cached reply content, and divides the cached reply content into fields waiting for sensitive word verification based on punctuation marks in the reply content as separators, and performs sensitive word verification on the fields waiting for sensitive word verification, after the verification is completed, clears the verified fields in the cache, and if it is verified that there are sensitive words in the cached reply content, sends a second request to the management service, and after receiving the second request, the management service forwards the underlying content data corresponding to the sensitive words to the terminal user, and after receiving the underlying content data, the terminal user replaces the displayed content with the underlying content, thereby performing parallel processing on the sensitive word verification and the terminal user displaying the reply content, thereby solving the problem that the existing large model streaming data sensitive word filtering increases the waiting time of the user. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 It is a flow chart of a sensitive word filtering method based on large model streaming data provided by the present invention. DETAILED DESCRIPTION

[0020] The present invention aims at the problem that the existing large-model streaming data sensitive word filtering will increase the waiting time of users, and provides a sensitive word filtering method based on large-model streaming data. For the reply content generated by a single large model, the reply content generated by the large model is forwarded to the sensitive word filtering service and the terminal user in the form of streaming data through the management service, so that the sensitive word verification and the terminal user display reply content are processed in parallel, which overcomes the problem that sensitive word filtering will increase the waiting time of users. The streaming data cache splicing is performed in the sensitive word filtering service to obtain the cached reply content, and the punctuation marks in the reply content are used as separators to divide the cached reply content into fields waiting for sensitive word verification, and the fields waiting for sensitive word verification are processed. Perform sensitive word verification. After the verification is completed, clear the verified fields in the cache to complete the sensitive word verification and ensure that the cache used space of the sensitive word filtering service will not increase with the increase of streaming data. If it is verified that there are sensitive words in the cached reply content, a second request is sent to the management service. After receiving the second request, the management service stops forwarding the streaming data and forwards the catch-all content data corresponding to the sensitive words to the terminal user. After the terminal user receives the catch-all content data, the displayed content is replaced with the catch-all content. In this way, when it is verified that the reply content generated by the large model contains sensitive words, it indicates that the reply content generated by the large model does not meet the specifications. Therefore, the displayed content of the terminal user is replaced with the catch-all content.

[0021] The present invention provides a sensitive word filtering method based on large model streaming data, such as Figure 1 As shown, the following steps are included:

[0022] S1. The terminal user connects to the management service through the connection channel and sends a first request to the management service;

[0023] Specifically, the link channel includes websocket.

[0024] S2. The management service determines the scenario according to the first request, obtains the scenario corresponding to the first request, and calls the corresponding big model to generate reply content according to the scenario;

[0025] Specifically, different big models are applicable to different scenarios. Therefore, for different scenarios, the corresponding big models are called to generate reply content to make the reply content more accurate.

[0026] S3. The management service forwards the reply content to the sensitive word filtering service and the terminal user in the form of streaming data, wherein the streaming data includes a plurality of continuous data packets;

[0027] Specifically, the data packet includes an identifier, and the identifier is used to determine the terminal user and the order of the data packets, so that the terminal user can be located through the identifier and the accuracy of restoring the streaming data into the reply content can be guaranteed through the identifier.

[0028] S4, the terminal user continues to receive data packets and displays the reply content in real time; the sensitive word filtering service continues to receive data packets, caches them, obtains the cached reply content, and uses punctuation marks in the reply content as separators to divide the cached reply content into fields waiting for sensitive word verification, and performs sensitive word verification on the fields waiting for sensitive word verification. After the verification is completed, the verified fields in the cache are cleared, and if the cached reply content is verified to contain sensitive words, a second request is sent to the management service;

[0029] Specifically, the sensitive word check is performed on the fields waiting for sensitive word check using the hanlp dictionary. In particular, for different scenarios, the sensitive words in the hanlp dictionary correspond to the scenarios. When multiple user terminals request at the same time, the second request includes the identifier so that the management service can accurately locate the terminal user.

[0030] S5. After receiving the second request, the management service stops forwarding the streaming data and forwards the backup content data corresponding to the sensitive word to the terminal user;

[0031] Specifically, the catch-all data can be unified as: Involving sensitive words, please try to generate again; that is, the catch-all content corresponding to each sensitive word is: Involving sensitive words, please try to generate again. The catch-all data can be saved in the sensitive word filtering server and sent to the management service by the second request, or saved in the management server. Different catch-all contents can also be set for different sensitive words. After the sensitive word is verified, the catch-all content is sent to the management service by the second request.

[0032] S6. After receiving the backup content data, the terminal user replaces the displayed content with the backup content.

[0033] For example, the streaming data corresponding to the content generated by the large model is ABCDEF, a total of 6 data packets, of which C contains a comma, F contains a period, and B contains a sensitive word. The corresponding underlying content data is Z. Then: data packet A is forwarded by the management service to the sensitive word filtering service and the terminal user, and the terminal user displays it as A, and the sensitive word filtering service caches it as A; data packet B is forwarded by the management service to the sensitive word filtering service and the terminal user, and the terminal user displays it as AB, and the sensitive word filtering service caches it as AB; data packet C is forwarded by the management service to the sensitive word filtering service and the terminal user, and the terminal user displays it as ABC, and the sensitive word filtering service caches it as ABC. When the sensitive word filtering service recognizes the comma in C, it caches ABC. Perform sensitive word verification. After the verification is completed, in addition to the verified field ABC in the cache, if it is verified that B contains sensitive words, a second request is sent to the management service. Since sensitive word verification takes time, data packet D will still be forwarded by the management service to the sensitive word filtering service and the terminal user. The terminal user displays it as ABCD, and the sensitive word filtering service caches it as D. After receiving the second request, the management service stops forwarding streaming data, that is, it will no longer forward E to the sensitive word filtering service and the terminal user, and forwards the backup content data Z corresponding to the sensitive word to the terminal user. After receiving Z, the terminal user replaces the displayed content ABCD with Z, thereby completing the reply content generated by a single large model and clearing D in the cache of the sensitive word filtering service.

Claims

1. A sensitive word filtering method based on large model streaming data, characterized in that: The method comprises the following steps: S1. The terminal user connects to the management service through the connection channel and sends a first request to the management service; S2. The management service determines the scenario according to the first request, obtains the scenario corresponding to the first request, and calls the corresponding big model to generate reply content according to the scenario; S3. The management service forwards the reply content to the sensitive word filtering service and the terminal user in the form of streaming data, wherein the streaming data includes a plurality of continuous data packets; S4, the terminal user continues to receive data packets and displays the reply content in real time; the sensitive word filtering service continues to receive data packets, caches them, obtains the cached reply content, and uses punctuation marks in the reply content as separators to divide the cached reply content into fields waiting for sensitive word verification, and performs sensitive word verification on the fields waiting for sensitive word verification. After the verification is completed, the verified fields in the cache are cleared, and if the cached reply content is verified to contain sensitive words, a second request is sent to the management service; S5. After receiving the second request, the management service stops forwarding the streaming data and forwards the backup content data corresponding to the sensitive word to the terminal user; S6. After receiving the backup content data, the terminal user replaces the displayed content with the backup content.

2. According to claim 1, the sensitive word filtering method based on large model streaming data is characterized in that: The link channel includes websocket.

3. According to claim 1, the sensitive word filtering method based on large model streaming data is characterized in that: The data packet includes an identifier, and the identifier is used to determine the terminal user and the order of the data packets.

4. According to claim 3, the sensitive word filtering method based on large model streaming data is characterized in that: The second request includes the catch-all content data corresponding to the sensitive word and the identifier.

5. According to claim 1, the sensitive word filtering method based on large model streaming data is characterized in that: The hanlp dictionary is used to perform sensitive word verification on the fields waiting for sensitive word verification.

6. The sensitive word filtering method based on large model streaming data according to any one of claims 1 to 5, characterized in that: The catch-all content includes: sensitive words involved, please try to generate again.