A method, medium, and electronic device for managing test speech in a human-computer interactive examination

Through the combination of shallow and deep models, combined with GPU parallel computing and Transformer attention mechanism, negative speech detection is used using dialogue history information, which solves the problems of large resource consumption and insufficient use of dialogue context information in the existing system, and achieves efficient Accurate negative speech identification and management.

CN118733726BActive Publication Date: 2025-01-14BEIJING XINNUOTONG INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410753087.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-12
Publication Date
2025-01-14
Estimated Expiration
2044-06-12

AI Technical Summary

Technical Problem

The existing human-computer interactive examination system consumes a lot of resources and has high deployment costs in negative speech detection, making it difficult to effectively utilize dialogue context information, resulting in insufficient real-time and scalability.

Method used

Using the combination of shallow model and deep model, GPU parallel computing and Transformer attention mechanism, preliminary negative scores are performed through shallow model, deep model is scored in depth, and precise judgment is made based on dialogue historical information to achieve negative remarks. Efficient identification and management.

Benefits of technology

It significantly improves the accuracy and processing efficiency of negative speech detection, supports efficient processing of large-scale real-time text input, ensures the stability and security of the system, effectively utilizes dialogue context information, and reduces resource consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118733726B_ABST
    Figure CN118733726B_ABST
Patent Text Reader

Abstract

The present invention provides a method, medium and electronic device for managing speech in a human-computer interaction test, belonging to the technical field of human-computer interaction test, including: using a negative speech database, fine-tuning based on a large language model, and obtaining a model capable of evaluating the negativity of input text. In the actual human-computer interaction test process, the system will obtain the input text of all examinees in real time, and start a sufficient number of CUDA streams for processing. Each CUDA stream will start a two-layer sub-thread grid, the first layer uses a shallow model to perform a preliminary negativity assessment, and the second layer uses a deep model combined with the examinee's conversation history for a more in-depth analysis. If the evaluation result exceeds the set threshold, the system will trigger an intervention mechanism, record the negative speech and prevent it from being output to the test system. Input that is not judged as negative speech will be recorded and appended to the examinee's conversation history. The problem of large resource consumption and high deployment cost of the existing technology is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of human-computer interaction examination, and in particular, relates to a method, medium and electronic equipment for managing speech in human-computer interaction examination. Background Art

[0002] With the rapid development of Internet technology, human-computer interaction systems have been widely used in various scenarios, such as online education, smart home, medical diagnosis and other fields. Among them, the human-computer interaction examination system, as an important teaching and evaluation method, has received widespread attention in the education community. This human-computer interaction examination system can realize real-time dialogue and interaction between candidates and computers, greatly improving the flexibility and interactivity of the examination. As an emerging educational technology, human-computer interaction examination has received widespread attention and application in recent years. It can create a more natural and creative examination environment for candidates, reduce the examination pressure of candidates, and provide teachers with more comprehensive and detailed assessment data. In such human-computer interaction examination systems, candidates often need to input various text information in real time, such as answering questions, discussing and communicating, etc. These input contents may involve some negative or controversial remarks. For these negative remarks, if they are not promptly and effectively controlled, they will not only affect the normal progress of the examination, but also may have some improper social impacts. Therefore, how to timely identify and deal with negative remarks in the process of human-computer interaction examination has become a technical problem that needs to be solved urgently.

[0003] In the prior art, methods based on keyword matching or machine learning models are usually used to detect negative speech. Among them, although the keyword matching method is simple and fast, it is difficult to deal with negative speech with complex semantics and strong metaphors; and the machine learning-based method requires a large amount of labeled data for model training, which is difficult to train and has high deployment costs. When faced with real-time input information from a large number of candidates, these methods often have difficulty meeting the requirements of real-time and scalability due to excessive resource consumption. In addition, the existing negative speech detection technology has an important limitation, that is, it is difficult to fully utilize the conversation context information between candidates. In the human-computer interaction test, each paragraph of the candidate's input text may be associated with the previous conversation content. If only a single input is analyzed in isolation, it is difficult to accurately determine whether it contains negative speech. Therefore, how to effectively use the conversation context information in negative speech detection is also a technical problem that needs to be solved urgently. Summary of the invention

[0004] In view of this, the present invention provides a human-computer interaction test speech management method, medium and electronic device, which can solve the problems of large resource consumption, high deployment cost and difficulty in effectively using dialogue context information to detect negative speech input by candidates when analyzing the candidates' speeches in the prior art.

[0005] The present invention is achieved in that:

[0006] A first aspect of the present invention provides a method for managing speech in a human-computer interaction test, which comprises the following steps:

[0007] S10, using a negative speech database, training a shallow model; and based on a large language base model, fine-tuning to obtain a deep model, wherein the shallow model is used to perform a preliminary negative score on the input text, and the deep model is used to perform a deep negative score on the input text and its associated context;

[0008] S20, during the actual human-computer interaction test, using the CPU to obtain the input texts of all examinees in real time, recorded as an input text set;

[0009] S30, start the maximum number of CUDA streams of the GPU, and start two layers of sub-thread grids in each CUDA stream, including a first layer of sub-thread grids and a second layer of sub-thread grids; if the number of candidates exceeds the number of CUDA streams, multiple batches are used; wherein the first layer of sub-thread grids runs the shallow model, and the second layer of sub-thread grids runs the deep model;

[0010] S40, inputting the latest input text allocated by each CUDA stream from the CPU into the shallow model of the negative speech recognition model, performing a preliminary negative score, and determining whether it is below a suspicious threshold;

[0011] S50, for the latest input text whose preliminary negativity score is lower than the suspicious threshold, the first-layer sub-thread grid directly returns the result to the CPU side and enters S80; for the latest input text whose preliminary score is higher than the suspicious threshold, the Transformer attention mechanism is used to automatically extract the context associated with the latest input text from the candidate's conversation history;

[0012] S60, sending the extracted associated context and the latest input text together to the deep model of the negative speech recognition model, and outputting a deep score of accurate negativity;

[0013] S70, the second-layer sub-thread grid returns the result of the depth score to the CPU side. If the depth score is higher than the determination threshold, the CPU determines that there is negative speech, triggers the intervention mechanism, records and archives the negative speech data, and blocks the harmful speech from being output to the examination system; otherwise, enter S80;

[0014] S80. The CPU records the input that is not judged as negative speech and appends it to the candidate's conversation history to ensure that the complete context can be obtained when subsequent input is matched.

[0015] It also includes: regularly converting the archived data into new training samples with context enhancement for retraining the shallow model and deep model of the negative speech recognition model to continuously improve the recognition accuracy of the negative speech recognition model.

[0016] The large language base model is selected from the Tongyi Qianwen or Zhipu Qingyan series base models. The base model is pre-trained with massive data and has certain general capabilities, which is equivalent to a huge knowledge base with "unknown potential", but it is difficult for humans to directly interact with it. The base model is selected to avoid the influence of the data of the fine-tuned model on the speech recognition of the human-computer interaction test.

[0017] The step S10 specifically includes:

[0018] Step 101, obtain an existing negative speech database as a data resource for transfer learning. The negative speech database is the basic data source of this method, which contains a large number of positive and negative speech text samples that have been manually annotated and confirmed. Positive samples are mainly harmless speeches commonly seen in daily life, while negative samples cover various negative speeches that are offensive, defamatory, hateful, inappropriate, etc. The database can come from an existing public data set on the Internet, or it can be a specialized database manually constructed based on a specific field or application scenario. Obtaining this high-quality data resource is the basis of this method, which will provide sample data support for subsequent model training.

[0019] Step 102: Using the negative speech database as a training data set, a lightweight neural network model (i.e., the shallow model) is trained. Specifically, the training input is to insert the negative speech text in the negative speech database into the ordinary text to form the whole text as the input; the training output is to extract the semantic features of the whole text, match the extracted semantic features with the semantic features of each record in the negative speech database, and obtain the matching degree of the whole text as the score of its negativity. This step adopts a transfer learning idea, using existing data resources to obtain a lightweight model for the negative speech recognition task through training. The so-called lightweight means that the model uses a relatively simple neural network structure, has a small number of parameters, and a fast inference speed, which is suitable for use as the first filter of the entire method. The role of the shallow model is to quickly perform a preliminary negative score on the input text to determine whether the text may contain negative content. If the score is low, it is directly judged as a normal text and returned; if the score is high, it is further sent to the deep model for more detailed analysis. By setting up such a shallow model, the real-time processing capability of the overall method can be greatly improved.

[0020] Step 103: Based on a large language model (such as Tongyi Qianwen or Zhipu Qingyan), fine-tune the model for the negative speech recognition task to obtain the deep model. The deep model is built on the basis of the large language model and is obtained by fine-tuning the model for a specific negative speech recognition task. The large language model used can be a well-known general large model in the industry, such as Tongyi Qianwen, Zhipu Qingyan, etc., or a special large model pre-trained for a specific field or scenario. These large language models can better capture the semantic information and contextual dependencies of the text due to their huge number of parameters and strong computing power, thereby providing strong support for negative speech recognition. By further fine-tuning training based on these large models, a deep model with deep negative speech recognition capabilities can be obtained. The deep model will work in conjunction with the previous shallow model to make further detailed analysis and judgment of suspected negative speech texts.

[0021] Among them, a lightweight neural network structure, also called a micro network structure, refers to a neural network model that requires a smaller number of parameters and a smaller computational cost. Since the shallow model required by the present invention only uses a preliminary negative score, a lightweight neural network structure can be used to implement it.

[0022] The step S20 specifically includes:

[0023] Step 201: During the actual human-computer interaction test, the input text of all examinees is obtained in real time;

[0024] Step 202: combine the input texts of all examinees into an input text set.

[0025] The step S20 is specifically that during the actual human-computer interaction test, the CPU side obtains the input texts of all candidates in real time and forms an input text set. In the human-computer interaction test scenario, candidates interact with the test system in real time through computer terminals or other human-computer interaction devices to answer questions, provide answers, etc. The CPU is responsible for real-time monitoring and collecting the input texts of these candidates, and forming them into an input text set for subsequent negative speech recognition processing. Since the test has the characteristics of real-time, the entire negative speech filtering system must have sufficient real-time response capabilities, otherwise it will affect the fluency of interaction and the fairness of the test.

[0026] The step S30 specifically includes:

[0027] Step 301: Start the maximum number of available CUDA streams on the GPU. In order to fully utilize GPU hardware resources, improve computing throughput and accelerate overall processing speed, this method uses GPU parallel computing technology based on CUDA streams. Each CUDA stream created on the GPU is equivalent to an independent execution thread, which can execute different computing tasks in parallel, greatly improving the utilization efficiency of the GPU. The purpose of this step is to start as many CUDA streams as possible on the GPU to prepare for subsequent parallel processing.

[0028] Step 302: Start the first layer of sub-thread grids and the second layer of sub-thread grids in each CUDA stream, where the first layer runs the shallow model and the second layer runs the deep model. The first layer of sub-thread grids is responsible for running the shallow negative speech recognition model trained previously to perform preliminary filtering and negative degree scoring on the input text; the second layer of sub-thread grids is responsible for running the deep model to perform detailed analysis and deep scoring on suspected negative text. By simultaneously starting these two layers of sub-thread grids in each CUDA stream, pipeline parallel processing can be achieved, fully utilizing GPU computing resources and improving overall throughput.

[0029] Step 303: If the number of candidates exceeds the number of CUDA streams, batch processing is adopted. Since the hardware resources of the GPU are limited, if the number of candidates that need to be processed at the same time exceeds the number of CUDA streams created, a batch processing strategy needs to be adopted. Specifically, the input texts of all candidates are grouped according to a certain batch size, and each batch is processed by a limited CUDA stream in turn until all input texts are processed. This batch method can effectively avoid the problem of not being able to process all inputs at the same time due to limited resources.

[0030] Step 304: Execute fine management and optimization strategies for the memory usage of the first and second layers of sub-thread grids on the GPU. Although the GPU has powerful parallel computing capabilities, its video memory resources are often relatively limited. If it is not properly managed, it is easy to have problems such as insufficient memory. Therefore, this step performs fine optimization and management on the memory usage of the two layers of sub-thread grids on the GPU to make full use of limited video memory resources and improve overall efficiency. Specifically, it includes the following aspects:

[0031] 1) A stream-based memory management mechanism is adopted to manage the required memory space for each CUDA stream separately to avoid resource competition and access conflicts between different streams.

[0032] 2) Through detailed memory reservation, reuse and timely release strategies, minimize memory fragmentation and peak occupancy and improve space utilization.

[0033] 3) Before starting the first-layer sub-thread grid, allocate a continuous memory area in the GPU memory for the shallow model parameters, input text data, and intermediate result data required for this layer. This ensures that the first-layer grid can quickly access all the required data during operation, and will not be inefficient due to fragmented memory space.

[0034] 4) After the first-layer sub-thread grid completes the preliminary scoring of the input text, it will immediately write the generated intermediate result data into the previously allocated video memory area and send a signal to notify the second-layer sub-thread grid to start reading input from this area. This method of timely exchanging input and output data avoids unnecessary data duplication and memory copy overhead.

[0035] 5) When the second-layer sub-thread grid is started, it reuses the video memory area released by the first-layer grid to store its own deep model parameters and temporary calculation data, and also leaves a free area for caching context data obtained from the host memory. This video memory reuse strategy can maximize the utilization of limited video memory.

[0036] 6) A scope-based automatic memory management mechanism is introduced, which automatically tracks the life cycle of each data area through the programming model and immediately reclaims the space occupied by the corresponding data when it is no longer needed, thus preventing memory leaks and improving memory utilization efficiency.

[0037] 7) During the implementation of the entire method, the model parameters required by the first-layer and second-layer sub-thread grids can be copied from the host memory to the reserved area of ​​the video memory in advance, avoiding repeated memory transfers during actual runtime, thereby improving the overall execution efficiency.

[0038] 8) Optionally, the implementation of this method also includes a memory usage monitoring mechanism based on GPU tracking, which can monitor the memory usage of the two-layer grid during operation in real time. Once an abnormality is found, it can issue a timely warning and take corresponding measures to ensure the stable operation of the system.

[0039] The step S40 is specifically to send the latest input text allocated by the CPU to the shallow model of the negative speech recognition model for each CUDA stream to perform a preliminary negative score, and determine whether the score is lower than the pre-set suspicious threshold. Each individual thread of the first-layer sub-thread grid is responsible for independently processing the scoring process of an input text, giving full play to the advantages of GPU parallel computing.

[0040] The step S50 is that for the latest input text whose initial negative score is lower than the suspicious threshold, the first-layer sub-thread grid will directly return the score result to the CPU side, and the CPU will determine that the input is normal text and enter step S80; for the latest input text whose initial score is higher than the suspicious threshold, the first-layer grid will use the self-attention mechanism in the Transformer model to automatically extract context information related to the current latest input from the candidate's historical dialogue records. The ability to automatically extract context is a major advantage of deep learning models over traditional methods. The attention mechanism can be used to adaptively learn which historical information is more important to the current negative speech recognition task based on the input.

[0041] The step S60 specifically includes sending the associated context information extracted in the previous step together with the current latest input text into the deep model of the negative speech recognition model for inference, and outputting an accurate negative deep score for the input text. The deep model here is based on the large language model and can well capture the semantic association between the input and the context, thereby accurately judging and deeply scoring potential negative speech. Among them, each individual thread of the second-layer sub-thread grid is responsible for processing the deep scoring process of an input text and its associated context.

[0042] The step S70 is specifically that the second-layer sub-thread grid returns the depth score result of the previous step to the CPU side. If the depth score is higher than another pre-set judgment threshold, the CPU determines that the input contains negative speech, and then triggers the corresponding intervention mechanism, including recording and archiving the negative speech data (which can be used for subsequent model retraining) and blocking the harmful negative speech from being output to the examination system. If the depth score is lower than the judgment threshold, it is judged as normal speech and enters step S80. This step can accurately identify potential negative speech at the two levels of preliminary filtering and fine analysis by setting two-level scoring thresholds.

[0043] The suspicious threshold and the determination threshold can be adjusted according to actual application requirements.

[0044] Among them, the shallow model adopts a lightweight neural network structure to improve processing efficiency; the deep model adopts the Transformer attention mechanism to fully capture the correlation between the input text and the context.

[0045] The negative speech database is composed of positive / negative samples, wherein the positive samples contain daily expressions that do not constitute negative speech, and the negative samples include various manually confirmed negative speech types.

[0046] The first-layer sub-thread grid runs the shallow model to perform the preliminary negativity scoring on the input text allocated from the CPU, and each thread of the first-layer sub-thread grid independently processes an input text.

[0047] The second-layer sub-thread grid runs the deep model to perform the deep analysis on the input text whose preliminary negativity score is higher than the suspicious threshold, and each thread of the second-layer sub-thread grid processes an input text and its associated context.

[0048] A second aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores program instructions, and when the program instructions are executed, they are used to execute the above-mentioned human-computer interaction examination speech management method.

[0049] A third aspect of the present invention provides an electronic device having a processor and a memory, wherein the memory is used to store the step program of the above method, and the processor reads the memory and executes the steps.

[0050] Compared with the prior art, the beneficial effects of the human-computer interactive examination speech management method, medium and electronic device provided by the present invention are: making full use of the parallel computing capability of the GPU, adopting a combination of shallow models and deep models, and realizing efficient and accurate negativity evaluation of a large amount of real-time input text.

[0051] Compared with the prior art, the solution of the present invention has the following significant advantages:

[0052] 1. Greatly improved processing efficiency and scalability. By starting multiple CUDA streams, each of which contains two layers of sub-thread grids to process candidate input in parallel, the throughput of negative speech detection is greatly improved, and it can support real-time input from a large number of candidates. At the same time, the dynamic memory management mechanism is adopted to effectively avoid problems such as memory overflow, further enhancing the scalability of the system.

[0053] 2. Improved the accuracy of negative speech detection. The solution of the present invention adopts a combination of shallow models and deep models, which can make full use of the correlation between the input text and the contextual dialogue history to give a more accurate negativity assessment. The shallow model quickly makes a preliminary judgment on the input, and the deep model uses the Transformer attention mechanism to extract relevant contextual information and make a more accurate negativity judgment based on it.

[0054] 3. A more intelligent and automated negative speech management is achieved. After identifying negative speech, the solution of the present invention will automatically record and archive the negative statement data and block its output to the examination system, effectively preventing the further spread of negative speech. At the same time, the input that is not judged as negative speech will also be recorded in the candidate's conversation history, providing more complete context information for subsequent analysis.

[0055] 4. Take into account the security and stability of the system. The solution of the present invention has carried out fine management and optimization on the use of GPU memory, including strategies such as memory reservation, dynamic allocation, and automatic recycling, to ensure that the system can maintain high memory utilization and processing performance under high load conditions, avoiding the occurrence of problems such as memory overflow. At the same time, a memory usage monitoring mechanism based on GPU tracking is introduced, which can adjust the memory allocation strategy in real time and improve the overall stability of the system.

[0056] In summary, the method for managing negative speech in human-computer interaction examinations proposed in the present invention not only meets the requirements of real-time and scalability, but also significantly improves the accuracy and intelligence level of negative speech detection, and takes into account the security and stability of the system, providing an effective solution for negative speech control in human-computer interaction examination scenarios. It solves the problem that when the existing technology analyzes the examinee's speech, there is a large consumption of resources, high deployment cost, and it is difficult to effectively use the dialogue context information to detect negative speech input from the examinee. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.

[0058] Figure 1 A roadmap for the method provided by the present invention. DETAILED DESCRIPTION

[0059] In order to make the purpose, technical solution and advantages of the embodiments of the present invention more clear, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention.

[0060] like Figure 1 FIG. 1 is a flow chart of a method for managing speech in a human-computer interactive examination provided by the present invention. The method comprises the following steps:

[0061] S10, using a negative speech database, training a shallow model; and based on a large language base model, fine-tuning to obtain a deep model, wherein the shallow model is used to perform a preliminary negative score on the input text, and the deep model is used to perform a deep negative score on the input text and its associated context;

[0062] S20, during the actual human-computer interaction test, using the CPU to obtain the input texts of all examinees in real time, recorded as an input text set;

[0063] S30, start the maximum number of CUDA streams of the GPU, and start two layers of sub-thread grids in each CUDA stream, including a first layer of sub-thread grids and a second layer of sub-thread grids; if the number of candidates exceeds the number of CUDA streams, multiple batches are used; wherein the first layer of sub-thread grids runs the shallow model, and the second layer of sub-thread grids runs the deep model;

[0064] S40, inputting the latest input text allocated by each CUDA stream from the CPU into the shallow model of the negative speech recognition model, performing a preliminary negative score, and determining whether it is below a suspicious threshold;

[0065] S50, for the latest input text whose preliminary negativity score is lower than the suspicious threshold, the first-layer sub-thread grid directly returns the result to the CPU side and enters S80; for the latest input text whose preliminary score is higher than the suspicious threshold, the Transformer attention mechanism is used to automatically extract the context associated with the latest input text from the candidate's conversation history;

[0066] S60, sending the extracted associated context and the latest input text together to the deep model of the negative speech recognition model, and outputting a deep score of accurate negativity;

[0067] S70, the second-layer sub-thread grid returns the result of the depth score to the CPU side. If the depth score is higher than the determination threshold, the CPU determines that there is negative speech, triggers the intervention mechanism, records and archives the negative speech data, and blocks the harmful speech from being output to the examination system; otherwise, enter S80;

[0068] S80. The CPU records the input that is not judged as negative speech and appends it to the candidate's conversation history to ensure that the complete context can be obtained when subsequent input is matched.

[0069] The specific implementation methods of the above steps are described in detail below:

[0070] The specific implementation method of step S10 is: first, obtain an existing negative speech database, which, as a data resource for transfer learning, contains manually annotated and confirmed positive and negative speech text samples, the positive samples mainly cover common harmless speech in daily life, and the negative samples cover various negative speech situations such as offensive, defamatory, hateful, and inappropriate content. The database can come from a public network data set, or it can be a special database manually constructed for a specific field or application scenario. Obtaining high-quality data resources is the basis of this method and provides support for subsequent model training. Secondly, using the negative speech database as a training data set, a lightweight neural network model, i.e., the shallow model, is obtained by training through transfer learning ideas. The specific training method is: inserting the negative speech text in the negative speech database into ordinary text to form the overall text as the input of the model; the model extracts semantic features from the overall text, and matches the extracted semantic features with the semantic features of each record in the negative speech database, and obtains the matching degree of the overall text as the scoring output of its negativity. The shallow model uses a relatively simple neural network structure with fewer parameters and faster inference speed. Its main function is to quickly and preliminarily score the input text for negative content and determine whether the text may contain negative content. If the score is low, it is directly judged as normal text and returned; if the score is high, it is further sent to the subsequent deep model for detailed analysis. Finally, the base model based on the large language model (such as General Thousand Questions or Zhipu Qingyan, etc.) is fine-tuned for the model of negative speech recognition task to obtain the deep model. The large language base model used can better capture the text semantics and contextual dependencies due to its huge number of parameters and strong computing power, providing strong support for negative speech recognition. By further fine-tuning on the basis of these large models, a deep model with deep recognition ability of negative speech can be obtained. The deep model will work together with the previous shallow model to make detailed analysis and judgment on suspected negative speech texts. The purpose of this step is to obtain a lightweight shallow model and a deep model based on a large language model through transfer learning and model fine-tuning, so as to jointly achieve rapid preliminary recognition and accurate deep judgment of negative speech.

[0071] The specific implementation method of step S20 is: during the actual human-computer interaction test, the CPU monitors and collects the texts input by all examinees through computer terminals or other human-computer interaction devices in real time, and forms these input texts into an input text set. Since the test is real-time, the entire negative speech filtering system must have sufficient real-time response capabilities, otherwise it will affect the fluency of the interaction and the fairness of the test. The CPU, as the central processing unit of the system, is responsible for obtaining the examinee's input in real time and recording it, preparing for the subsequent negative speech recognition processing.

[0072] The specific implementation method of step S30 is: first, start the maximum number of available CUDA streams of the GPU. CUDA is a parallel computing architecture for GPU launched by NVIDIA. By creating multiple CUDA streams, different computing tasks can be executed in parallel on the GPU, greatly improving the utilization efficiency of GPU resources. Secondly, start the first-layer sub-thread grid and the second-layer sub-thread grid in each CUDA stream at the same time. The first-layer grid is specifically used to run the shallow negative speech recognition model trained before, and perform preliminary filtering and negative scoring on the input text; the second-layer grid is used to run the deep model to perform detailed analysis and deep scoring on suspected negative text. By starting these two layers of sub-thread grids in each CUDA stream at the same time, pipeline parallel processing can be achieved, GPU computing resources can be fully utilized, and overall throughput can be improved. If the number of candidate inputs that need to be processed at the same time exceeds the number of CUDA streams created, a batch processing strategy is adopted to group all input texts according to a certain batch size, and each batch is processed successively through a limited number of CUDA streams until all input texts are processed. Finally,

[0073] Continuing to describe the optimization strategy for memory usage on the GPU in the specific implementation of step S30:

[0074] A sophisticated management and optimization strategy is used for the memory usage of the first and second layer sub-thread grids on the GPU, including:

[0075] 1) A stream-based memory management mechanism is adopted to manage the required memory space for each CUDA stream separately to avoid resource competition and access conflicts between different streams.

[0076] 2) Through detailed memory reservation, reuse and timely release strategies, minimize memory fragmentation and peak occupancy and improve space utilization.

[0077] 3) Before starting the first-layer sub-thread grid, allocate a continuous memory area in the GPU video memory for the shallow model parameters, input text data, and intermediate result data required for this layer to ensure that the first-layer grid can quickly access the required data when running, and will not be inefficient due to fragmented video memory space.

[0078] 4) After the first-layer sub-thread grid completes the preliminary scoring of the input text, it will immediately write the generated intermediate result data into the previously pre-allocated video memory area, and send a signal to notify the second-layer sub-thread grid to start reading input from this area, avoiding unnecessary data duplication and memory copy overhead.

[0079] 5) When the second-layer sub-thread grid is started, it will reuse the video memory area released by the first-layer grid to store the deep model parameters and temporary calculation data required by itself. At the same time, it will reserve a free area for caching context data obtained from the host memory to maximize the video memory utilization.

[0080] 6) Introduce a scope-based automatic memory management mechanism, which automatically tracks the life cycle of each data area through the programming model, and immediately reclaims the space occupied by the corresponding data when it is no longer needed, preventing memory leaks and improving utilization efficiency.

[0081] 7) The model parameters required for the first and second layer sub-thread grids can be copied from the host memory to the reserved area of ​​the video memory in advance, avoiding repeated memory transfers at runtime and improving overall execution efficiency.

[0082] 8) Optionally, a memory usage monitoring mechanism based on GPU tracking is included to monitor the memory usage during the operation of the two-layer grid in real time. Once an abnormality is found, a timely warning can be issued and corresponding measures can be taken to ensure stable operation of the system.

[0083] The purpose of this step is to make full use of GPU hardware resources, through CUDA stream-based parallel computing technology, batch processing strategy and sophisticated video memory management optimization, to maximize the real-time processing capability and throughput of the entire negative speech recognition system, and prepare for the efficient execution of subsequent steps.

[0084] The specific implementation method of step S40 is: for each CUDA stream, the latest input text allocated from the CPU side is sent to the shallow model of the negative speech recognition model for preliminary negative score, and it is judged whether the score is lower than the pre-set suspicious threshold. Among them, the reference value of the suspicious threshold is set to 0.6, that is, when the negative score output by the shallow model is lower than 0.6, it is preliminarily determined that the input text is unlikely to contain negative speech. Each individual thread of the first-layer sub-thread grid independently processes the scoring process of an input text, giving play to the advantages of GPU parallel computing and improving processing efficiency. This step, as a preliminary filtering of the input text, can quickly exclude a large number of obviously harmless normal texts, reducing the computing pressure of the subsequent deep model.

[0085] The specific implementation method of step S50 is: for input texts whose preliminary negative score is lower than the suspicious threshold in step S40, the first-layer sub-thread grid will directly return the score result to the CPU, and the CPU will determine that the input is normal text and enter step S80; for input texts whose preliminary score is higher than the suspicious threshold, the first-layer sub-thread grid will use the self-attention mechanism in the Transformer model to automatically extract context information related to the current latest input from the historical conversation records of the examinee. The self-attention mechanism is an attention calculation method for sequence data (such as text). It automatically learns the most important context information for the task by calculating the degree of association between the current input and each position in the historical sequence without manually setting rules. This mechanism is a major advantage of deep learning models over traditional methods. By automatically extracting relevant context, more comprehensive context information can be provided for subsequent deep analysis, thereby improving the accuracy of negative speech recognition.

[0086] The specific implementation method of step S60 is: the associated context information extracted in step S50 is sent to the deep model of the negative speech recognition model together with the current latest input text for inference, and an accurate negative deep score of the input text is output. Since the deep model is built on the basis of a large language model (such as General Thousand Questions or Zhipu Qingyan, etc.), after fine-tuning the model for the negative speech recognition task, it can well capture the semantic association relationship between the input text and the context, so as to accurately judge and deeply score the potential negative speech. Among them, each individual thread of the second-layer sub-thread grid is responsible for processing the deep scoring process of an input text and its associated context, which accelerates the calculation in parallel. As a fine analysis link for suspected negative text, this step can greatly improve the accuracy and robustness of negative speech recognition by utilizing context information and the powerful semantic understanding ability of the large language model.

[0087] The specific implementation method of step S70 is: the second-layer sub-thread grid returns the negative depth score result obtained in step S60 to the CPU end. If the depth score is higher than another pre-set judgment threshold, the CPU determines that the input contains negative speech, and then triggers the corresponding intervention mechanism. The reference value of the so-called judgment threshold is set to 0.8, that is, when the depth score exceeds 0.8, it is determined that the input does contain negative speech content. Once the existence of negative speech is confirmed, the CPU will perform the following processing measures: 1) record and archive the negative speech data, which can be used for subsequent model retraining to continuously improve the recognition ability of the model; 2) block the harmful negative speech from being output to the examination system to prevent negative content from affecting the fairness and impartiality of the examination. If the depth score is lower than the judgment threshold, it is determined to be normal speech and enters step S80. This step realizes the accurate identification of potential negative speech by setting two-level scoring thresholds (suspicious threshold and judgment threshold).

[0088] The specific implementation method of step S80 is: the CPU appends the input records that are not judged as negative remarks to the candidate's conversation history record to ensure that complete context information can be obtained during subsequent input matching.

[0089] Specifically, for the input text whose depth score is lower than the judgment threshold in step S70, the CPU determines that it is normal speech and does not constitute negative speech. At this time, the CPU will record the input text and append it to the end of the candidate's existing conversation history record. The purpose of doing so is to ensure that when processing the candidate's subsequent input, the previous conversation record can be considered as context information, thereby improving the accuracy of the judgment of context relevance.

[0090] The retention and update of conversation history records follow a first-in-first-out (FIFO) queue structure. When new input is added, the oldest record at the head of the queue will be removed to ensure that the queue length remains within a reasonable range and avoids unlimited use of too much memory. At the same time, considering the differences in input rhythm and frequency of different candidates, the queue length of conversation history records can be dynamically adjusted according to actual conditions. For candidates with higher input frequency, the length can be appropriately increased, while for candidates with less input, the length can be reduced accordingly to make full use of limited memory resources.

[0091] In addition to recording the input text, the CPU also synchronously retains the corresponding timestamp information to identify the exact time when each input occurs, so that subsequent context extraction can more accurately determine the time correlation between texts.

[0092] In addition, during the update process of the conversation history records, an approximate nearest neighbor search algorithm based on local sensitive hashing can be used to judge the semantic similarity of the historical records, and obviously irrelevant historical records can be removed in a timely manner, retaining only contextual information that has a certain correlation with the current input, thereby further optimizing memory usage and improving the efficiency of subsequent processing.

[0093] The purpose of this step is to ensure that the negative speech recognition system can effectively use historical context information, improve the ability to capture the conversation context, and provide more comprehensive semantic clues for the judgment of the negativity of the input text, thereby further improving the overall recognition accuracy. At the same time, through the dynamic adjustment and optimization strategy of the conversation history records, it is possible to obtain sufficient context information while avoiding unnecessary waste of memory resources.

[0094] In summary, steps S10-S80 jointly construct a negative speech recognition system that uses a two-level structure of shallow models and deep models, combines contextual information and large language model capabilities. The system has fast preliminary filtering capabilities and accurate deep analysis capabilities, can efficiently respond to real-time human-computer interaction scenarios, timely discover and block negative and harmful speech, and ensure the fairness and justice of application scenarios such as examinations. At the same time, the design of the system focuses on the rational use of computing resources, and maximizes processing efficiency and throughput through multiple strategies such as GPU-based parallel computing, batch processing, and fine memory management optimization. In addition, the system also provides a path for continuous improvement. By recording and archiving negative speech data and using it for model retraining, the recognition accuracy of the model can be continuously improved, so that the entire system has the ability of self-iterative optimization.

[0095] Furthermore, S30 also includes fine management and optimization of the memory usage of the first and second layer sub-thread grids on the GPU, and reasonable allocation of memory to accommodate the model parameters and intermediate data required for the two layers.

[0096] Among them, the specific implementation method of optimizing the memory usage of the first and second layer sub-thread grids on the GPU is: adopting a stream-based video memory management mechanism, through detailed memory reservation, reuse and timely release strategies, to minimize memory fragmentation and peak occupancy. Before starting the first layer of sub-thread grids, a continuous memory area will be allocated in advance in the GPU video memory for the shallow model parameters, input text data and intermediate results required by this layer to ensure fast access to the data required during the operation of the first layer. After the first layer of sub-thread grids completes the preliminary scoring of the input text, the generated intermediate result data will be immediately written to the pre-allocated video memory area, and a signal will be sent to notify the second layer of sub-thread grids to start reading input from this area; when the second layer of sub-thread grids are started, the video memory area released by the first layer will be reused to store the parameters and temporary data of the deep model, and a free area will be reserved for caching context data obtained from the host memory; when the second layer of sub-thread grids are running on the GPU, they will dynamically apply for and release video memory space according to actual needs, for example, first obtain a part from the free area as a context data cache, release it back to the free area immediately after processing, and then apply for another part to continue the operation. In the implementation process of this method, a scope-based automatic video memory management mechanism is introduced. Through the programming model, the life cycle of each data area is automatically tracked, and the space is immediately reclaimed when it is no longer needed, thereby improving the memory utilization efficiency. In this method, the model parameters required by the first-layer and second-layer sub-thread grids can be copied from the host memory to the video memory reserved area in advance, avoiding repeated memory transfers at runtime and improving the overall execution efficiency. Optionally, the implementation of this method also includes a memory usage monitoring mechanism based on GPU tracking, which can monitor the memory usage dynamics of the two-layer grid in real time, and dynamically adjust the memory allocation strategy according to the usage to avoid memory overflow or waste.

[0097] 1. Importance of memory usage optimization:

[0098] In the human-computer interactive test language management system, negative speech detection for a large amount of input text is a computationally intensive task. In order to improve processing efficiency, the system makes full use of the parallel computing power of GPU and completes the detection work by starting multiple CUDA streams, each of which contains two layers of sub-thread grids.

[0099] This GPU-based parallel processing method places high demands on memory usage. First, a large amount of input text data needs to be loaded and processed simultaneously. Second, negative speech recognition models, including shallow models and deep models, require a large amount of video memory space to store model parameters and intermediate calculation results. In addition, in the deep analysis stage, contextual information related to the current input needs to be dynamically obtained from the host memory, which also puts pressure on the GPU memory.

[0100] If the memory is used improperly, problems such as video memory overflow and memory fragmentation are likely to occur, causing a significant drop in system performance or even a crash. Therefore, fine-grained management and optimization of GPU memory usage for the first-layer and second-layer sub-thread grids is the key to improving the efficiency and stability of the entire negative speech detection system.

[0101] 2. Stream-based video memory management mechanism

[0102] In order to achieve fine management of GPU memory usage, this solution adopts a memory management mechanism based on CUDA streams. The specific approach is as follows:

[0103] (1) Memory reservation and data layout optimization

[0104] Before starting the first-layer sub-thread grid, the system will pre-allocate a continuous memory area in the GPU memory for the shallow model parameters, input text data, and intermediate results required for this layer. This ensures fast access to the data required during the first layer's operation, avoiding memory fragmentation and the overhead of repeated memory requests.

[0105] At the same time, the system will optimize the storage layout of these data, for example, storing input text data and intermediate results continuously to make full use of the locality of memory and improve access efficiency.

[0106] (2) Result delivery and spatial reuse

[0107] When the first-layer sub-thread grid completes the preliminary scoring of the input text, it immediately writes the generated intermediate result data into the pre-allocated video memory area and sends a signal to notify the second-layer sub-thread grid to start reading input from this area. This can achieve efficient pipeline work for the first and second layers and reduce the transmission overhead of intermediate data between the CPU and GPU.

[0108] At the same time, when the second-layer sub-thread grid is started, it will reuse the video memory area released by the first layer to store the parameters and temporary data of the deep model, avoiding the overhead of repeated memory applications and improving memory utilization.

[0109] (3) Dynamic memory allocation and recycling

[0110] When the second-layer sub-thread grid is running, it will dynamically apply for and release video memory space according to actual needs. For example, it will first obtain a part from the free area as context data cache, and immediately release it back to the free area after processing, and then apply for another part to continue computing.

[0111] This on-demand dynamic allocation method can make full use of GPU memory, avoiding the problem of memory fragmentation and static pre-allocation of too much memory. At the same time, timely recycling of unused memory areas also greatly improves memory utilization efficiency.

[0112] 3. Automatic video memory management based on scope

[0113] In order to further simplify the complexity of memory management, this solution introduces a scope-based automatic memory management mechanism. This mechanism automatically tracks the life cycle of each data area through a programming model and reclaims the corresponding memory space immediately when it is no longer needed.

[0114] Specifically, in the implementation of the first and second layers of sub-thread grids, some local variables are defined to store intermediate calculation results. The scope of these variables is limited to the current thread grid, and once the thread grid is executed, these variables are no longer needed.

[0115] The system automatically monitors the life cycle of these local variables, and when they exceed the scope, the occupied video memory space is immediately released back to the free pool for subsequent use. This automatic management mechanism based on scope greatly simplifies the burden of programmers to manually manage memory, and also improves the efficiency of memory utilization.

[0116] 4. Preloading of model parameters

[0117] In addition to optimizing the memory usage of intermediate calculation results, this solution also makes special treatment for the parameters of the negative speech recognition model.

[0118] Before starting the first and second layers of sub-thread grids, the system will copy the required model parameters from the host memory to the reserved area of ​​the GPU video memory. In this way, when the sub-thread grid is actually running, there is no need to transfer memory from the CPU to the GPU, which greatly improves the overall execution efficiency.

[0119] For the shallow model of the first layer, since its structure is relatively simple and the number of parameters is small, all parameters can be preloaded into the GPU memory at one time. For the deep Transformer model of the second layer, since the number of parameters is large, the system will adopt a block preloading strategy, that is, divide the model parameters into multiple sub-blocks and copy them to the GPU memory in batches as needed.

[0120] This preloading mechanism not only avoids the memory transfer overhead at runtime, but also ensures that the model parameters are always located in the high-speed GPU memory, further improving the overall performance of negative speech detection.

[0121] 5. Memory usage monitoring based on GPU tracking

[0122] In order to better control the usage of GPU memory, this solution also introduces a memory usage monitoring mechanism based on GPU tracking.

[0123] This monitoring mechanism can monitor the memory usage dynamics of the first and second layer sub-thread grids on the GPU in real time, including various indicators such as overall memory usage, memory fragmentation, memory request / release frequency, etc. By analyzing these indicators, the system can promptly identify problems in memory usage and adjust the memory allocation strategy accordingly.

[0124] For example, if the memory usage is detected to be too high, a mechanism for dynamically adjusting memory allocation may be triggered, such as appropriately increasing the size of the free memory pool or adjusting the block loading strategy of model parameters. On the contrary, if the memory utilization is detected to be low, the size of the memory pool can be appropriately reduced to release more GPU resources for other purposes. This adaptive memory management mechanism based on real-time monitoring can ensure that the system can maintain high memory utilization and processing performance under various load conditions.

[0125] In general, this negative speech management method in the human-computer interaction test system fully utilizes the advantages of GPU parallel computing and adopts a combination of shallow models and deep models to achieve efficient and accurate negative evaluation of a large amount of input text. The key technical points include:

[0126] 1. Use the negative speech database for transfer learning and train a special negative speech recognition model.

[0127] 2. Combining shallow models with deep models can improve processing efficiency while ensuring accuracy.

[0128] 3. Use the Transformer attention mechanism to automatically extract relevant contextual information and enhance the model's ability to understand the input text.

[0129] 4. Reasonably set the suspicion threshold and judgment threshold to minimize misjudgment while ensuring accuracy.

[0130] 5. Make full use of the parallel computing capabilities of GPU and achieve efficient batch processing through CUDA streams and sub-thread grids.

[0131] In order to better understand this method, the specific implementation method of this method is explained in more detail below in combination with specific formulas:

[0132] The specific implementation method of step S10:

[0133] First, obtain the negative speech database in Contains N labeled samples. i Represents the text input of the i-th sample, y i ∈{0,1} is the label of the sample, 0 represents normal speech and 1 represents negative speech.

[0134] by As a training data set, we adopt the idea of ​​transfer learning to train a shallow model f θ (·), where θ is the model parameter. The objective function of the model is defined as:

[0135]

[0136] in is some loss function, such as the binary cross entropy loss function By optimizing this objective function, the model can learn to map the input text x to a probability value f θ (x), as the preliminary score of negativity.

[0137] For the deep model, based on the parameters φ of the large language model (such as GPT or BERT, etc.), fine-tuning training is performed for the negative speech recognition task to obtain new model parameters φ′. The objective function of the fine-tuning process is:

[0138]

[0139] Among them, g φ′ (·,·) is the deep model after fine-tuning; (x i ,c i ,y i ) is the i-th fine-tuning sample, where x i For input text, c i is the relevant context, y i By optimizing this objective function, the model learns to use the input text and its context to perform a deep negative score.

[0140] Specific implementation of step S40:

[0141] For input text x, the shallow model f θ (x) Output its preliminary negative score. If the score is lower than the suspicious threshold τ1, then f θ (x)<τ1, it is initially judged as normal text. The reference value of τ1 is set to 0.6.

[0142] The specific implementation method of step S50:

[0143] For the initial score f θ For an input x with (x)≥τ1, the multi-head self-attention mechanism in the Transformer model is used to extract important information from the relevant context c. Specifically, assuming that the input x is a word sequence {x1, x2, ..., x n}, context c is a word sequence {c1,c2,...,cm}, then the self-attention calculation process is:

[0144] Q=XW Q

[0145] K=CW K

[0146] V=CW V

[0147]

[0148] Among them, W Q ,W K ,W V is the trainable projection matrix; d k is a scaling factor used to ensure the numerical stability of the dot product. This mechanism automatically extracts the most relevant context information for the current task by calculating the correlation between the input x and each position in the context c.

[0149] Specific implementation of step S60:

[0150] The context c extracted in step S50 is fed into the deep model g together with the input x φ′ (x,c) to perform reasoning and output accurate negative depth scores. Among them, the deep model is based on the Encoder-Decoder structure of Transformer, which can effectively integrate input and context information:

[0151] h (l) = Transformer-Block(h (l-1) )

[0152] z=MLP dec (h (L) )

[0153] g φ′ (x,c)=σ(z)

[0154] Here, h (l) Represents the output of the l-th layer Transformer block; MLP dec is the feedforward neural network of the decoder; σ(·) is the sigmoid activation function, which constrains the output to the interval [0,1] as the depth score of the negativity.

[0155] Specific implementation of step S70:

[0156] If the depth score g φ′ If (x,c) is higher than the judgment threshold τ2, it is judged that there is negative speech and the intervention measures are triggered. Here, the reference value of τ2 is set to 0.8.

[0157] The relevant variables are explained as follows: represents the negative speech database, which is a collection of labeled samples; N: represents the negative speech database The total number of samples in x i : represents the text input of the i-th sample; y i : represents the label of the i-th sample, y i ∈{0,1}, where 0 represents normal speech and 1 represents negative speech; f θ (·): represents a shallow model, where θ is a model parameter; represents the objective function of the shallow model, which is used to optimize the model parameters θ; represents the loss function, such as the binary cross entropy loss function; g φ′ (·,·): represents the fine-tuned deep model, where φ′ is the fine-tuned model parameter; represents the fine-tuning objective function of the deep model, which is used to optimize the model parameter φ′; N′: represents the total number of samples used for fine-tuning the deep model; c i : represents the relevant context information of the i-th fine-tuning sample; τ1: represents the suspicious threshold, which is used to judge the preliminary score of the shallow model, and the reference value is set to 0.6; n: represents the word sequence length of the input text x; m: represents the word sequence length of the context c; Q, K, V: represent the matrix representation of query, key and value respectively; W Q ,W K ,W V : represents the trainable projection matrix that projects the input x and context c into the query, key and value spaces respectively; d k : represents the scaling factor, which is used to ensure the numerical stability of the dot product in the self-attention calculation; h (l) : represents the output of the l-th layer Transformer block; MLP dec : represents the feedforward neural network of the decoder; σ(·): represents the sigmoid activation function, which is used to constrain the output of the deep model to the interval [0,1]; τ2: represents the judgment threshold, which is used to judge the depth score of the deep model, and the reference value is set to 0.8.

[0158] A second aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores program instructions, and when the program instructions are executed, they are used to execute the above-mentioned human-computer interaction examination speech management method.

[0159] A third aspect of the present invention provides an electronic device, which comprises a processor and a memory, wherein the memory is used to store the step program of the above method, and the processor reads the memory and executes the steps.

[0160] Specifically, the principle of the present invention is to make full use of the parallel computing capability of GPU, adopt a combination of shallow model and deep model, and a sophisticated GPU memory management mechanism to achieve efficient and accurate negativity evaluation of a large amount of real-time input text.

[0161] 1. Negative speech recognition model based on deep learning

[0162] First, the solution of the present invention uses an existing negative speech database, and through transfer learning, takes a large universal language base model as a starting point, and fine-tunes and trains it carefully, thereby obtaining a model specifically used for identifying negative speech. This negative speech recognition model consists of two parts: a shallow model and a deep model.

[0163] The purpose of the shallow model is to make a preliminary assessment of the negativity of the input text. It uses a lightweight neural network structure to quickly process a large amount of input text and give a preliminary negativity score. This preliminary score is used to determine whether the input text contains suspicious negative content. If it is below a certain suspicious threshold, it is directly identified as normal text without further analysis.

[0164] For input texts whose initial ratings exceed the suspicious threshold, a more complex deep model is needed for further analysis. The deep model uses the Transformer architecture and uses the self-attention mechanism to capture the correlation between the input text and the conversation history. It not only considers the current input text, but also automatically extracts the relevant contextual information to make a more accurate negative assessment.

[0165] 2. GPU-based memory optimization management

[0166] In order to ensure that this solution can maintain high efficiency and stability under large-scale parallel processing, the key lies in the careful management and optimization of GPU memory. The present invention adopts the following key measures:

[0167] (1) Memory pre-allocation and data layout optimization

[0168] Before starting the first-layer sub-thread grid, the system will pre-allocate a continuous memory area in the GPU memory for the data required for this layer (such as input text, shallow model parameters, etc.). This ensures fast access to the data required during the operation of the first layer, avoiding memory fragmentation and the overhead of repeated memory requests. At the same time, the system will optimize the storage layout of these data, such as storing input text data and intermediate results continuously to make full use of the locality of memory.

[0169] (2) Result delivery and spatial reuse

[0170] When the first-layer sub-thread grid completes the preliminary scoring, it will immediately write the generated intermediate result data into the pre-allocated video memory area and notify the second-layer sub-thread grid to start reading. This pipelined working method reduces the transmission overhead of intermediate data between the CPU and GPU. At the same time, when the second layer is started, it will reuse the video memory area released by the first layer to store deep model parameters and temporary data, avoiding the problem of repeated memory application.

[0171] (3) Dynamic memory allocation and recycling

[0172] When the second-layer sub-thread grid is running, it will dynamically apply for and release video memory space according to actual needs, such as obtaining context data cache and releasing it immediately after processing. This on-demand allocation method can make full use of GPU memory and avoid memory fragmentation and excessive static pre-allocation. At the same time, it can recycle unused memory areas in a timely manner, greatly improving memory utilization efficiency.

[0173] (4) Automatic memory management based on scope

[0174] This solution also introduces an automatic memory management mechanism based on scope. For local variables in the first and second-layer sub-thread grids, the system automatically monitors their life cycle and immediately releases the occupied video memory space once they exceed the scope. This automatic management method greatly simplifies the burden of programmers to manually manage memory and also improves memory utilization.

[0175] (5) Preloading of model parameters

[0176] In addition to optimizing the intermediate calculation results, this solution also makes special processing for the parameters of the negative language recognition model. Before starting the sub-thread grid, the system will copy the required model parameters from the host memory to the reserved area of ​​the GPU video memory. In this way, when the sub-thread grid is actually running, there is no need to transfer memory from the CPU to the GPU, which greatly improves the execution efficiency. For the first-layer shallow model, all parameters can be preloaded at once; for the second-layer deep Transformer model, a block preloading strategy is adopted.

[0177] (6) Memory usage monitoring based on GPU tracking

[0178] This solution also introduces a memory usage monitoring mechanism based on GPU tracking. This mechanism can monitor the memory usage dynamics of the first-layer and second-layer sub-thread grids on the GPU in real time, including overall memory usage, memory fragmentation, memory request / release frequency, etc. By analyzing these indicators, the system can promptly identify problems in memory usage and adjust the memory allocation strategy in a targeted manner to ensure that the system can maintain high memory utilization and processing performance under various load conditions.

[0179] In summary, based on GPU parallel processing, the present invention has adopted a series of sophisticated memory optimization measures, including memory pre-allocation, dynamic allocation and recovery, automatic management, etc., which effectively solves the memory usage problem in the process of large-scale real-time input processing and lays a solid foundation for the efficient and stable operation of the negative speech detection system.

[0180] The above description is only a specific implementation mode of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.

[0181] The following is a specific embodiment of the present invention: In recent years, a university has vigorously promoted the construction of online education and intelligent examination systems, and has developed a set of examination systems based on human-computer interaction. The examination system uses natural language dialogue, and candidates can answer questions by keyboard input, and the system will give feedback and scores in real time.

[0182] However, in actual use, teachers also found some problems. Some candidates would input some negative comments during the examination, such as personal attacks, insulting language, etc., which not only affected the fairness and order of the examination, but also may have a negative impact on other candidates. In order to solve this problem, the university decided to introduce the human-computer interaction examination negative speech management method proposed by the present invention to ensure the healthy and orderly operation of the examination system.

[0183] The following is the implementation of the method of the present invention in the human-computer interaction examination system of the university:

[0184] 1. Data preparation

[0185] First, the university built a database covering different types of negative speech by collecting corpora from various online discussion forums, social media and other channels. After preliminary annotation, there were 20,000 samples, including 15,000 samples with negative speech and 5,000 samples without negative speech. This negative speech database will serve as the basis for training and fine-tuning the negative speech recognition model of the method of the present invention.

[0186] Table 1 Statistics of negative speech database samples

[0187] Sample Type Sample size Contains negative comments 15,000 No negative comments 5,000 total 20,000

[0188] To evaluate the performance of the method, the university also collected an independent test set consisting of 3,000 input texts actually collected in exams, 500 of which contained negative remarks.

[0189] 2. Model training and fine-tuning

[0190] Based on the above negative speech database, the university selected the Tongyi Qianwen model as the initial universal language base model, fine-tuned it through transfer learning, and obtained a model specifically for negative speech recognition. Specifically, the objective function of the training is:

[0191] arg min θ ΣN d L(f(x i ;θ),y i )

[0192] Among them, x i represents the i-th sample text in the negative speech database, y i ∈{0,1} is its label (0 means no negative comments, 1 means negative comments), N d =20,000 is the total number of samples, θ is the model parameter to be optimized, f(x;θ) is the negative speech recognition model, which gives the probability that the input text x is judged as negative speech, and L(·,·) is the cross entropy loss function.

[0193] After 50 epochs of iterative training, the accuracy of the negative speech recognition model on the test set reached 95%, which is better than the method using a general sentiment analysis model.

[0194] In order to further improve processing efficiency, the negative speech recognition model is divided into two parts: a shallow model and a deep model. The shallow model uses a lightweight 3-layer convolutional neural network structure, which can quickly make a preliminary negative assessment of the input text. The deep model uses a 12-layer Transformer encoder, which can more deeply analyze the correlation between the input text and the context and give a more accurate negative judgment.

[0195] During the training process, the suspicious threshold τ1=0.3 and the judgment threshold τ2=0.6 were reasonably set to minimize misjudgment while ensuring a high accuracy rate.

[0196] Table 2 Performance evaluation of negative speech recognition model

[0197] Model Accuracy Recall F1-score General sentiment analysis model 0.85 0.80 0.82 The method of the present invention (shallow layer) 0.92 0.90 0.91 The method of the present invention (deep layer) 0.95 0.93 0.94

[0198] 3. System integration and real-time processing

[0199] In order to apply the method of the present invention in real time and efficiently in the human-computer interaction examination system, the university further optimized the system architecture and processing flow.

[0200] First, they started eight CUDA streams, each of which started two layers of sub-thread grids. Considering that the examination system can accommodate up to 200 candidates at the same time, such GPU resource configuration can meet the needs of real-time processing.

[0201] During the test, all the candidate's input text will be captured in real time to form an input text set. Where n is the number of candidates currently taking the test. This input text set is evenly distributed to 8 CUDA streams for processing.

[0202] Specifically, each CUDA stream first assigns the input text x to i Send it to the shallow model to calculate its initial negative score s1(x i ). If s1(x i )<0.3, then directly determine x i It is normal text and does not require further analysis. i )≥0.3, using the Transformer attention mechanism to learn from the candidate's dialogue history Automatic extraction and x i Highly relevant contextual snippets

[0203] Then, x i and Input into the deep Transformer model together to calculate the accurate negative score if If negative comments are found, they will be recorded and archived, and shielded from being output to the examination system. i The conversation history of the candidate is recorded and added to the candidate's conversation history. middle.

[0204] Through this GPU-based parallel computing method, the university successfully implemented the negative speech management method proposed in the present invention in the human-computer interactive examination system. In a recent large-scale examination, a total of 182 candidates were online at the same time, and each candidate entered an average of 120 texts. During the entire examination, a total of 2 negative speeches were detected, all of which were blocked in time and did not cause any interference to the examination.

[0205] Table 3 Statistics of negative speech detection during the exam

[0206] index Numeric Total number of candidates 182 Average number of texts entered per person 120 Total input text 21,840 Negative comments detected 2 System processing delay (average) 0.15s

Claims

1. A method for managing speech in a human-computer interactive examination, characterized in that: The following steps are involved: S10, using a negative speech database, training a shallow model; and based on a large language base model, fine-tuning to obtain a deep model, wherein the shallow model is used to perform a preliminary negative score on the input text, and the deep model is used to perform a deep negative score on the input text and its associated context; S20, during the actual human-computer interaction test, using the CPU to obtain the input texts of all examinees in real time, recorded as an input text set; S30, starting the maximum number of CUDA streams of the GPU, starting two layers of sub-thread grids in each CUDA stream, including a first layer of sub-thread grids and a second layer of sub-thread grids; if the number of candidates exceeds the number of CUDA streams, multi-batch processing is adopted; wherein the first layer of sub-thread grids runs the shallow model to perform the preliminary negativity scoring on the input texts allocated from the CPU, and each thread of the first layer of sub-thread grids independently processes one input text; The second-layer sub-thread grid runs the deep model; it is used to perform deep analysis on the input text whose preliminary negativity score is higher than the suspicious threshold, and each thread of the second-layer sub-thread grid processes an input text and its associated context; The step S30 also includes the steps of finely managing and optimizing the memory usage of the first layer sub-thread grid and the second layer sub-thread grid on the GPU, and allocating memory to accommodate the model parameters and intermediate data required by the two layers; S40, inputting the latest input text allocated from the CPU to each CUDA stream into the shallow model of the negative speech recognition model, performing a preliminary negative score, and determining whether it is below the suspicious threshold; S50, for the latest input text whose preliminary negative score is lower than the suspicious threshold, the first-layer sub-thread grid directly returns the result to the CPU side and enters S80; for the latest input text whose preliminary score is higher than the suspicious threshold, the Transformer attention mechanism is used to automatically extract the context associated with the latest input text from the candidate's conversation history; S60, sending the extracted associated context and the latest input text together to the deep model of the negative speech recognition model, and outputting a deep score of accurate negativity; S70, the second-layer sub-thread grid returns the result of the depth score to the CPU side. If the depth score is higher than the determination threshold, the CPU determines that there is negative speech, triggers the intervention mechanism, records and archives the negative speech data, and blocks the negative speech from being output to the examination system; otherwise, enter S80; S80. The CPU records the input that is not judged as negative speech and appends it to the candidate's conversation history to ensure that the complete context can be obtained when subsequent input is matched.

2. A method for managing speech in a human-computer interaction examination according to claim 1, characterized in that: Also includes: The step of regularly converting the archived data into new training samples with context enhancement for retraining the shallow model and the deep model to continuously improve the recognition accuracy of the shallow model and the deep model.

3. A method for managing speech in a human-computer interaction examination according to claim 1, characterized in that: The large language base model selects the base model of Tongyi Qianwen or Zhipu Qingyan.

4. A method for managing speech in a human-computer interaction examination according to claim 1, characterized in that: The shallow model adopts a lightweight neural network structure.

5. A method for managing speech in a human-computer interaction examination according to claim 1, characterized in that: The negative speech database consists of positive samples or negative samples, the positive samples contain daily expressions that do not constitute negative speech, and the negative samples include various manually confirmed negative speech types.

6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program instructions, and when the program instructions are executed, they are used to execute the method for managing speech in a human-computer interactive examination according to any one of claims 1 to 5.

7. An electronic device, characterized in that: A computer readable storage medium as claimed in claim 6 having a processor and communicating with each other.

Citation Information

Patent Citations

  • Language model training method and device, electronic device, and storage medium

    JP2024003750A

  • Method and apparatus for cross-language question generation

    WO2021243706A1