An end-to-end model reasoning acceleration system
Through end-to-end model inference acceleration system integration, the problem of inference speed and efficiency of deep learning model on edge devices is solved, efficient model deployment and reasoning is achieved, the inference process of multiple application scenarios is accelerated, and the system is improved Universality.
Patent Information
- Application Number
- CN202411338922.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2044-09-25
AI Technical Summary
The prior art when deploying deep learning models on resource-constrained edge devices, the inference speed and efficiency are difficult to meet the needs of multiple application scenarios and lack universality.
An end-to-end model inference acceleration system is proposed, through the integration of modules such as data preprocessing, model analysis, hardware detection, model deployment, model acceleration, model inference, post-processing and result output, the end from data input to result output is realized. To-end inference process, and significantly improve inference speed and efficiency through hardware detection and model acceleration technologies.
The system simplifies the deployment process of deep learning models, improves inference speed and efficiency, enhances the versatility of the system, and can adapt to a variety of hardware platforms and model types without the need for extensive custom optimization for a specific platform or model.
Smart Images

Figure CN118863071B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence and edge computing technology, and in particular to an end-to-end model reasoning acceleration system. Background Art
[0002] With the rapid development of artificial intelligence, deep learning models have been widely used in image recognition, natural language processing, autonomous driving and other fields. However, the computational complexity of deep learning models is relatively high, especially when deployed on resource-constrained edge devices, the inference speed and efficiency become urgent issues to be solved.
[0003] Existing technologies usually reduce the amount of computation through model pruning, quantization and other means, but these methods often require a trade-off between model accuracy and inference speed. In addition, different application scenarios have different requirements for inference speed and accuracy. How to design a general and efficient inference acceleration engine architecture that can adapt to a variety of application scenarios and significantly improve inference speed while maintaining model accuracy is still a technical challenge.
[0004] Current inference acceleration technologies usually rely on high-performance computing hardware, such as GPUs and TPUs, and need to be optimized for specific models during deployment, which increases development difficulty and deployment costs and lacks versatility. Summary of the invention
[0005] Based on the above technical problems, the present invention proposes an end-to-end model reasoning acceleration system to simplify the deployment process of deep learning models, realize end-to-end model reasoning and acceleration, and improve the versatility of the reasoning acceleration system. The specific technical solution is as follows.
[0006] An end-to-end model reasoning acceleration system includes the following modules:
[0007] Data preprocessing module: preprocesses the original input data and converts it into a format suitable for model processing;
[0008] Model parsing module: parses the input deep learning model in detail to ensure that the model is correctly loaded and adapted to the target hardware environment;
[0009] Hardware detection module: detects the performance parameters of the current hardware and provides the hardware information required for model deployment;
[0010] Model deployment module: deploys the model to the target hardware and adjusts the model's inference path and parameter settings according to the hardware configuration;
[0011] Model acceleration module: optimizes and accelerates the deployed model;
[0012] Model inference module: receives input data from the data preprocessing module, uses the accelerated model to perform inference, and generates preliminary inference results;
[0013] Post-processing module: processes and optimizes the preliminary reasoning results generated by the model reasoning module;
[0014] Result output module: outputs the final post-processed results to users or downstream application systems according to the application scenario.
[0015] Specifically, the data preprocessing module preprocesses the original input data including:
[0016] Format conversion: converting various raw data types into the input format required by the model;
[0017] Data normalization: Normalize the data according to the model requirements and normalize the text embedding vector;
[0018] Noise filtering and data enhancement: Perform denoising, blurring, and data enhancement on image data.
[0019] Specifically, the original input data includes text, images, videos, audio and sensor data.
[0020] Specifically, the model parsing module performs detailed parsing of the input deep learning model including:
[0021] Model structure analysis: extract the hierarchical structure of the model and determine the dependencies between layers;
[0022] Parameter extraction and verification: extract weight parameters from the model file and verify the consistency and integrity of the parameters;
[0023] Feedback mechanism: Based on the parsed model structure, the input data format requirements are fed back to the data preprocessing module.
[0024] Specifically, the model deployment module deploys the model to the target hardware including:
[0025] Model loading and adaptation: Load the parsed model into memory and adapt it according to the hardware information provided by the hardware detection module;
[0026] Run path optimization: optimize the model's calculation path according to hardware characteristics and select the optimal calculation graph execution order;
[0027] Parameter tuning and configuration: Adjust the batch size and number of parallel computing threads of the model according to the computing power and memory capacity of the hardware.
[0028] Specifically, the acceleration processing of the model acceleration module includes:
[0029] Operator fusion: multiple computing operators in the model are merged into one operator;
[0030] Computational graph optimization: Rearrange or simplify the calculation order by analyzing the model's computational graph;
[0031] Hardware acceleration utilization: Optimization algorithms specifically designed for hardware accelerator applications;
[0032] Low-precision calculation: Mixed precision calculation is used while ensuring the accuracy of the model.
[0033] Specifically, the model reasoning module specifically includes:
[0034] Efficient reasoning execution: Use the optimized model to quickly reason about input data;
[0035] Multi-task support: supports parallel execution of multiple reasoning tasks to meet the needs of various application scenarios;
[0036] Inference result cache: caches frequently used inference results.
[0037] Specifically, the post-processing module processes and optimizes the preliminary reasoning results generated by the model reasoning module, specifically including:
[0038] Denormalization and decoding: Denormalize the preliminary inference results and convert them into the numerical range of the original data space, and perform decoding operations at the same time;
[0039] Format conversion: convert the inference results into a format that meets application requirements;
[0040] Result screening and optimization: The inference results are screened according to the set thresholds or rules, and the prediction results that do not meet the requirements are eliminated.
[0041] Specifically, the output forms of the result output module include classification label output, regression value output, detection box output and decision result output.
[0042] Beneficial effects of the present invention: The present invention proposes an end-to-end model reasoning acceleration system, which realizes an end-to-end reasoning process from data input to result output through the integration of various modules, and significantly improves the speed and efficiency of reasoning through hardware detection and model acceleration technology; the present invention designs an integrated reasoning acceleration system architecture to make the model deployment process smoother, reduce intermediate links, reduce deployment complexity, support full-process automated processing from data input to reasoning output, and ensure the consistency and efficiency of the reasoning process. In addition, the system architecture has strong adaptability and can support a variety of hardware platforms and model types without a large amount of customized optimization for specific platforms or models, thereby improving the versatility and flexibility of the model reasoning acceleration system. At the same time, it has a high degree of versatility and can adapt to a variety of hardware platforms and model types, simplifying the model deployment process and providing users with a more convenient and efficient solution. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 This is an architecture diagram of an end-to-end model reasoning acceleration system of the present invention. DETAILED DESCRIPTION
[0044] In order to have a clearer understanding of the technical features, purposes and effects of the present invention, specific embodiments of the present invention are now described with reference to the accompanying drawings.
[0045] The present invention proposes an end-to-end model reasoning acceleration system, the architecture of which is as follows: Figure 1 As shown in the figure, through the collaborative work of the following modules, the goals of simplifying the model deployment process, improving the inference speed, and enhancing the versatility of the system are achieved.
[0046] Data preprocessing module: The data preprocessing module is the entrance to the entire inference acceleration system and is responsible for converting raw input data into a format suitable for model processing. For different application scenarios, input data may include text, images, videos, sensor data, etc. The main functions of the data preprocessing module include:
[0047] Format conversion: Convert various raw data (such as images, text, and audio) into the input format required by the model. For example, convert a JPEG image to a tensor or convert text to an embedded vector.
[0048] Data normalization: Normalize the data according to the model requirements, such as normalizing pixel values to the range of [0, 1] or normalizing text embedding vectors to ensure data distribution consistency.
[0049] Noise filtering and data enhancement: For image data, perform denoising, blurring and other operations to improve data quality; data enhancement (such as rotation, flipping, etc.) can also be performed to improve the generalization ability of the model.
[0050] Through the processing of the data preprocessing module, the original data can be uniformly formatted and standardized to ensure the quality and consistency of the input data, thereby reducing the uncertainty in the model reasoning process and improving the accuracy and speed of reasoning.
[0051] Model parsing module: The model parsing module is responsible for detailed parsing of the input deep learning model, including model structure, hierarchical relationship, parameter configuration, etc., to ensure that the model can be correctly loaded and adapted to the target hardware environment. Its specific functions include:
[0052] Model structure analysis: Extract the hierarchical structure of the model (such as convolutional layer, pooling layer, fully connected layer) and determine the dependencies between layers.
[0053] Parameter extraction and verification: Extract weight parameters from the model file and verify the consistency and completeness of the parameters to ensure the correctness of the model.
[0054] Feedback mechanism: Based on the parsed model structure, the input data format requirements are fed back to the data preprocessing module to ensure the compatibility of the data and the model.
[0055] By parsing the model, the model parsing module ensures that the model can be loaded and executed correctly, providing guarantee for the operation of the model in different hardware environments. In addition, the module can also optimize the model structure and improve the reasoning efficiency according to the characteristics of the specific hardware environment.
[0056] Hardware detection module: The hardware detection module is a key component in the inference acceleration engine. It is responsible for detecting the performance parameters of the current hardware and providing the hardware information required for model deployment. Its main functions include:
[0057] Hardware configuration detection: obtain hardware computing power (such as CPU / GPU core number and frequency), memory capacity, I / O performance and other information.
[0058] Parallel processing capability assessment: Detect the parallel processing capability of the hardware and evaluate the maximum number of threads it supports, SIMD (single instruction multiple data) instruction set, etc.
[0059] Hardware library file access: Access hardware-related library files (such as CUDA, cuDNN, and OpenCL) to obtain detailed hardware acceleration capabilities and supported optimization algorithms.
[0060] The hardware detection module ensures that the inference acceleration system can understand and adapt to the performance characteristics of the target hardware, thereby providing the necessary information support for model deployment and acceleration. By fully understanding the hardware, the system can better adjust the model's running path and optimization strategy to maximize the use of hardware resources.
[0061] Model deployment module: The task of the model deployment module is to deploy the model to the target hardware and adjust the model's reasoning path and parameter settings according to the hardware configuration. Specific functions include:
[0062] Model loading and adaptation: Load the parsed model into memory and adapt it according to the hardware information provided by the hardware detection module. For example, on memory-constrained devices, unnecessary model layers or parameters can be trimmed.
[0063] Run path optimization: Optimize the model's calculation path based on hardware characteristics (such as GPU architecture and cache size) and select the optimal calculation graph execution order.
[0064] Parameter tuning and configuration: According to the computing power and memory capacity of the hardware, adjust the model's batch size, number of parallel computing threads and other parameters to achieve optimal performance.
[0065] Through the optimization of the model deployment module, the system can ensure the efficient operation of the model on the target hardware and reduce the performance bottleneck caused by hardware differences. Especially on resource-constrained devices, the optimization of this module can significantly improve the inference efficiency.
[0066] Model acceleration module: The model acceleration module is the core component of the entire inference acceleration system, responsible for further optimization and acceleration of the deployed model. The main acceleration technologies include:
[0067] Operator fusion: Multiple computing operators in the model are merged into one operator to reduce the overhead of memory reading and writing and data transmission, thereby improving computing efficiency. In this embodiment, for different deep learning model structures, operator fusion can be implemented through the following specific methods:
[0068] Convolutional layer fusion: In convolutional neural networks, the convolution operation is combined with the calculation steps of batch normalization or activation functions (such as ReLU), thereby reducing memory access and calculation steps. This optimization can greatly improve the inference efficiency in image processing tasks (such as image classification or object detection);
[0069] Layer-by-layer operator merging: For models with multiple linear layers or matrix multiplication operations, you can merge the calculations of adjacent layers, especially in sequence models for natural language processing, such as the Transformer architecture. By merging matrix operations of multiple layers, data transmission can be reduced and processing efficiency can be improved.
[0070] Calculation graph optimization: By analyzing the calculation graph of the model, rearrange or simplify the calculation order to reduce redundant calculations and data dependencies and optimize execution time. In this embodiment, the optimization of the calculation graph mainly relies on the following two methods:
[0071] Static optimization: By analyzing the model's computational graph, invalid computational nodes (such as redundant computations that do not affect the output results) are removed or the order is rearranged. For example, in a recommendation system or semantic analysis task, some paths are computed less frequently, so the main path can be optimized first;
[0072] Dynamic optimization: For tasks that require frequent adjustment of input data or model structure (such as online learning or time series prediction), you can dynamically compile the computational graph and use software compilation technology to optimize the computational path under different input scenarios.
[0073] Hardware acceleration utilization: For hardware accelerators such as GPU and TPU, apply dedicated optimization algorithms (such as CUDA and OpenCL) to maximize the parallel computing capabilities of the hardware. In this embodiment, for different hardware accelerators (such as GPU, TPU or FPGA), acceleration can be performed through the following dedicated optimization algorithms:
[0074] Convolution optimization algorithm: For computational acceleration in convolutional neural networks, the Winograd algorithm commonly used on GPUs can effectively reduce matrix multiplication operations and is suitable for image classification and video processing tasks. FPGA platforms can optimize convolution calculations through deep pipeline design;
[0075] Tensor decomposition: For high-dimensional matrix operations, applying tensor decomposition algorithms (such as CP decomposition and Tucker decomposition) can reduce computational complexity, which is particularly suitable for natural language processing tasks such as Transformer that require a large number of matrix multiplications;
[0076] Instruction set optimization for specific hardware: For example, on TPU, the optimized XLA compiler is used to convert the model's operations into the TPU instruction set to accelerate reasoning.
[0077] Low-precision calculation: Under the premise of ensuring the accuracy of the model, mixed precision calculation (such as FP16, INT8) is used to reduce the amount of calculation and memory usage and improve the reasoning speed. In this embodiment, mixed precision calculation is calculated by floating-point numbers of different precisions (FP16 and FP32) to improve the reasoning speed while ensuring the accuracy of the model. The specific implementation methods are as follows:
[0078] Task adaptability adjustment: For example, in image classification tasks, the convolution layer can use FP16 first, while the final classification layer can use FP32 to ensure classification accuracy. In semantic analysis, the embedding layer can use low precision, while the final prediction layer uses high precision;
[0079] Dynamic precision adjustment: For time-sensitive tasks (such as autonomous driving or real-time video processing), the precision can be adjusted dynamically according to real-time needs. For example, when the inference time is insufficient, low-precision calculations are used first to increase the speed, and high precision is restored when the inference time is sufficient;
[0080] Mixed precision based on error tolerance: For tasks with high error tolerance (such as recommendation systems), low-precision calculations can be used for some neurons with smaller weights, while high-precision can be used for key layers to maximize computational efficiency.
[0081] Through multiple optimizations of the model acceleration module, the system can significantly improve the reasoning speed of the model, especially in application scenarios with high concurrency and high real-time requirements. This module can effectively reduce reasoning delays and improve the overall performance of the system.
[0082] Model reasoning module: The model reasoning module is responsible for the actual reasoning task, receives input data from the data preprocessing module, and uses the accelerated model for reasoning to generate preliminary reasoning results. The main functions include:
[0083] Efficient reasoning execution: Use the optimized model to quickly reason about the input data to ensure that prediction results are generated in the shortest time.
[0084] Multi-task support: supports parallel execution of multiple reasoning tasks to meet the needs of various application scenarios (such as image classification, target detection, natural language processing, etc.).
[0085] Inference result cache: Cache commonly used inference results to improve the processing efficiency of subsequent similar tasks and reduce repeated calculations.
[0086] The model reasoning module provides the system with powerful reasoning capabilities, which can efficiently perform reasoning tasks in different hardware environments, ensuring the consistency and efficiency of the reasoning process. In addition, through the result caching mechanism, the module can further improve the response speed of the system.
[0087] Post-processing module: The post-processing module is responsible for further processing and optimization of the preliminary results generated by the model reasoning module to ensure that the output results meet the application requirements. The main functions include:
[0088] Denormalization and decoding: Denormalize the inference results and convert them into the numerical range of the original data space. At the same time, perform decoding operations (such as converting the probability value output by the model into a specific category label).
[0089] Format conversion: Convert the inference results into a format that meets the application requirements, such as converting the coordinates of the detection box into pixel units, or converting the classification results into readable text.
[0090] Result screening and optimization: According to the set thresholds or rules, the inference results are screened and predictions that do not meet the requirements are eliminated to ensure the reliability and accuracy of the final output.
[0091] Through the optimization and adjustment of the post-processing module, the system can generate the final reasoning results that meet the application requirements, ensuring the interpretability and practicality of the results. Especially in application scenarios with strict requirements on output results (such as autonomous driving and medical diagnosis), the post-processing module can effectively improve the overall performance and safety of the system.
[0092] Result output module: The result output module is responsible for outputting the final results after post-processing to the user or downstream application system. The specific output form varies according to different application scenarios, such as:
[0093] Classification label output: For image classification or text classification tasks, output the final category label or classification result.
[0094] Regression value output: For regression tasks, output specific predicted values, such as the price value in house price prediction.
[0095] Detection box output: For object detection tasks, the coordinates and category information of the detection box are output to mark the target object in the image or video.
[0096] Decision result output: In application scenarios such as autonomous driving or industrial control, the decision results of the model are output, such as steering angle, acceleration and other control instructions.
[0097] Through the result output module, the system can deliver the final results of model reasoning to users or downstream applications in a readable and usable form, thus completing the whole process from input data to final output. This module ensures the practicality and user experience of the system.
[0098] The present invention also provides the following embodiments:
[0099] Example 1: End-to-end model reasoning acceleration based on image classification tasks
[0100] In this embodiment, the proposed end-to-end model inference acceleration system architecture is used to accelerate an image classification task based on a deep learning model.
[0101] 1. Data preprocessing module: In image classification tasks, the data to be predicted is usually the original image. First, the data preprocessing module receives these image data and performs the following operations:
[0102] Format conversion: Convert images from different file formats (such as JPEG, PNG) to the Tensor format required by the model.
[0103] Normalization: Normalize the image pixel values and adjust them to the range of [0, 1] or [-1, 1] to meet the input requirements of the model.
[0104] Noise filtering: Apply filters to remove noise from images, such as Gaussian filters.
[0105] Through these preprocessing steps, the consistency and standardization of the input image data are ensured, providing high-quality input for subsequent model reasoning.
[0106] 2. Model parsing module: In this module, the system will parse the structure and parameters of the image classification model used (such as ResNet, VGG, etc.). The model parsing module will:
[0107] Identify the model hierarchy: extract each layer of the model, such as convolutional layer, pooling layer, fully connected layer, etc.
[0108] Load weight configuration: Load the model weight parameters from the pre-trained model file.
[0109] Model adaptation: Adjust the model structure according to the hardware configuration (such as CPU or GPU) to ensure that the model can run efficiently on specific hardware.
[0110] After parsing, the model parsing module passes the relevant information to the model deployment module.
[0111] 3. Hardware detection module: Before the system performs model inference, it needs to detect the current hardware configuration. The hardware detection module will:
[0112] Check the computing capabilities: such as the number of CUDA cores of the GPU, memory capacity, etc.
[0113] Access hardware library files: Get specific information about the hardware, such as GPU driver version, CPU architecture, etc.
[0114] With this information, the system can optimize the model's reasoning path and maximize the use of hardware resources.
[0115] 4. Model deployment module: This module performs model adaptation and deployment based on the hardware information provided by the hardware detection module and the model structure information provided by the model parsing module. The specific steps include:
[0116] Parameter Tuning: Adjust the parameters of the model, such as batch size, to fully utilize the memory and computing power of the hardware.
[0117] Model compilation: Compile and optimize the execution path of the model for the target hardware, such as using the parallel computing capabilities of the GPU.
[0118] Storage path configuration: Assign reasonable storage paths to the model's weight files, configuration files, etc. to improve access efficiency.
[0119] 5. Model acceleration module: After the model is deployed, the system will further accelerate and optimize the model. The model acceleration module uses the following technologies:
[0120] Operator fusion: fuse adjacent computing operators in the model to reduce the storage and transmission of intermediate computing results.
[0121] Graph optimization: Optimize the model's computational graph to reduce redundant computational paths and speed up the reasoning process.
[0122] The application of these technologies can significantly improve the efficiency of model reasoning.
[0123] 6. Model Reasoning Module: In image classification tasks, the model reasoning module is responsible for performing the actual reasoning operation. This module inputs the preprocessed image data into the accelerated model and generates preliminary classification results.
[0124] 7. Post-processing module: The classification results generated by the model inference module may need further processing. The post-processing module will:
[0125] Denormalization: Denormalize the predicted classification results to make them consistent with the scale of the original data.
[0126] Format conversion: Convert the prediction results into the format required by the user, such as JSON, XML, etc.
[0127] Result screening: Filter the prediction results that do not meet the requirements according to the preset threshold.
[0128] 8. Result output module: The final classification result after post-processing will be passed to the user or downstream application system through the result output module. The result can be stored in the server in JSON format or directly displayed on the user interface.
[0129] Example 2: End-to-end model reasoning acceleration based on natural language processing tasks
[0130] In this embodiment, in natural language processing (NLP) tasks, the model usually needs to process a large amount of text data, involving complex language models (such as BERT, GPT, etc.), and is computationally intensive. Therefore, accelerating the inference process can not only improve system performance, but also significantly shorten the response time in practical applications. This embodiment will detail how to optimize the inference speed and efficiency in NLP tasks through end-to-end inference acceleration system architecture.
[0131] 1. Data preprocessing module: The input data of NLP tasks is mostly unstructured text data. The data preprocessing module needs to convert these text data into a format that the model can process. The specific steps are as follows:
[0132] Text cleaning: remove stop words, punctuation, convert text to lowercase, etc. Through these operations, the computational overhead of the model in processing irrelevant information is reduced.
[0133] Word segmentation and part-of-speech tagging: Segment the text and identify the part of speech of each word. In some tasks, such as sentiment analysis, part-of-speech information may help improve the prediction accuracy of the model.
[0134] Word vectorization: Convert the segmented text into word vectors. Word vectorization can use pre-trained word embedding models (such as Word2Vec, GloVe) or dynamic word embedding methods (such as BERT's word embedding). This conversion represents text data as vectors, allowing it to be directly input into deep learning models.
[0135] Through the above steps, the data preprocessing module not only ensures the standardization of the input data format, but also reduces the time the model spends on processing unnecessary information and improves the efficiency of model reasoning.
[0136] 2. Model parsing module: In NLP tasks, the models used are usually complex deep learning architectures, such as Transformer, BERT, GPT, etc. These models require a lot of computing resources, and the model parameters are large, and the parsing process is relatively complex. The specific functions of the model parsing module are as follows:
[0137] Model hierarchy identification: Extract the model's hierarchical structure, including the embedding layer, attention layer, fully connected layer, etc. The model parsing module identifies the computational logic and data dependencies of each layer by analyzing the model architecture.
[0138] Parameter parsing and optimization: Extract weight parameters from pre-trained model files and perform necessary quantization and compression operations. Optimize the model's parameter processing efficiency by reducing the number of bits in floating-point calculations or using mixed precision calculations.
[0139] Model characteristics and hardware adaptation: According to the information provided by the hardware detection module, the model structure is adjusted, such as sparse processing of the self-attention mechanism to reduce the amount of calculation. On resource-constrained edge devices, the model parsing module can also decide whether to prune the model or simplify the layers to adapt to the hardware environment.
[0140] Through the model parsing module, the system can ensure that complex NLP models can be efficiently loaded and executed in different hardware environments, avoiding performance bottlenecks caused by mismatched model structures.
[0141] 3. Hardware detection module: The hardware detection module plays a key role in NLP tasks, especially when the model needs to run on resource-constrained devices. The workflow of this module is as follows:
[0142] Computing power evaluation: Check the number of cores, clock frequency, memory capacity, etc. of the system's CPU / GPU / TPU and other computing units to determine the computing power of the hardware.
[0143] Parallel computing support: Analyzes the parallel computing capabilities of the hardware, such as multi-core processing, the number of GPU CUDA cores, and the matrix processing unit of the TPU, and provides support information for the parallel execution of the model.
[0144] Hardware interface and driver: Ensure that the hardware driver and system interface are in the best state to avoid the decline in inference efficiency caused by hardware and software compatibility issues.
[0145] The hardware detection module not only provides detailed information about the hardware environment, but also provides a reference for subsequent model deployment and optimization, enabling the model to run efficiently within the maximum range of hardware capabilities.
[0146] 4. Model deployment module: The model deployment module is responsible for optimizing deployment based on the parsed model information and hardware configuration in NLP tasks. Specific operations include:
[0147] Model Sharding and Parallelization: For large-scale NLP models, such as BERT, the model deployment module can shard the model so that different parts can be executed in parallel on multiple computing units. This strategy greatly shortens the inference time.
[0148] Dynamic batch processing: Dynamically adjust the batch size according to the length and complexity of the input data to optimize memory usage efficiency. This is especially important when processing text sequences of varying lengths.
[0149] Memory management and cache optimization: During deployment, the model deployment module optimizes memory usage, avoids unnecessary data exchange, and improves the efficiency of data reading and storage through the cache mechanism.
[0150] Through these measures, the model deployment module ensures that the NLP model can achieve optimal inference performance on different hardware platforms.
[0151] 5. Model acceleration module: The model acceleration module is the core of the entire architecture. It significantly improves the reasoning speed of the NLP model through multiple technical means:
[0152] Computational graph optimization: For the Transformer architecture, the model acceleration module optimizes its computational graph and reduces redundant computation paths. For example, by merging linear transformation operations in advance, the amount of computation for multiple matrix multiplications can be reduced.
[0153] Operator fusion and quantization: The model acceleration module fuses common operators in the model to reduce the number of memory accesses. At the same time, quantization technology (such as 8-bit integer operations) is used to reduce the computational complexity of the model.
[0154] Mixed-precision training and reasoning: Using mixed-precision (FP16+FP32) technology, the amount of calculation is reduced and the reasoning speed is improved while ensuring the accuracy of the model.
[0155] The application of these technologies has significantly improved the reasoning speed of NLP models, especially in large-scale text processing tasks.
[0156] 6. Model reasoning module: In NLP tasks, the model reasoning module is responsible for the final reasoning calculation. The specific process is as follows:
[0157] Input data processing: Receives preprocessed text vectors and feeds them into the optimized model.
[0158] Parallel reasoning: By leveraging the parallel computing capabilities of hardware, the model reasoning module can process multiple text inputs simultaneously, further shortening the reasoning time.
[0159] Dynamically adjust the reasoning path: Based on the length and complexity of the input data, the model reasoning module can dynamically adjust the reasoning path, such as skipping irrelevant calculation steps.
[0160] Through these optimizations, the model reasoning module can complete complex NLP task reasoning in a shorter time, such as text classification and sentiment analysis.
[0161] 7. Post-processing module: The post-processing module converts the preliminary inference results of the model into a usable output format in NLP tasks. The specific operations include:
[0162] Result decoding and format conversion: Decode the model's output results (such as probability distribution) into actual classification labels or sentiment scores, and convert them into standard formats such as JSON and XML as required.
[0163] Result aggregation and filtering: For multi-text or multi-task reasoning results, the post-processing module aggregates the results of multiple rounds of reasoning and filters the results according to the set thresholds or rules.
[0164] Result enhancement and interpretation: By post-processing the model output, such as generating explanatory labels or adding explanations, the final output results are made easier to understand and use.
[0165] Through these operations, the post-processing module ensures that the output results of the NLP model meet user needs and are highly practical and interpretable.
[0166] 8. Result output module: Finally, the result output module provides the processed text classification or sentiment analysis results to users or downstream application systems. Users can choose a variety of output forms, such as API interface, data file, real-time display, etc., so that the model's reasoning results can be effectively applied to actual business scenarios.
[0167] Example 3: End-to-end model reasoning acceleration based on autonomous driving
[0168] Autonomous driving is a popular application in the current field of artificial intelligence, involving multiple complex subtasks such as perception, decision-making, and control. To achieve safe and stable operation of vehicles in real-time driving environments, autonomous driving systems rely on efficient model reasoning capabilities. Since autonomous driving requires extremely low latency (usually at the millisecond level) and real-time processing of large amounts of sensor data, this embodiment will focus on how to optimize the reasoning performance in autonomous driving systems through an end-to-end reasoning acceleration engine architecture.
[0169] 1. Data preprocessing module: The input data of autonomous driving includes various sensor data such as images, lidar point clouds, radar data, GPS information, etc. These data are often large in volume and in various formats. The main functions of the data preprocessing module are as follows:
[0170] Multimodal data synchronization and fusion: Data collected from sensors such as cameras, lidar, and millimeter-wave radars have different timestamps and formats. The data preprocessing module is responsible for synchronizing these multimodal data to ensure that data within the same time window can be accurately matched and fused to provide complete environmental perception information.
[0171] Image preprocessing: For the image data collected by the camera, perform denoising, enhancement, scaling and other processing operations to ensure image quality while reducing the computational burden. This module is also responsible for converting the image into a tensor format suitable for model input.
[0172] Point cloud data processing: LiDAR point cloud data is usually large and noisy. The data preprocessing module filters, downsamples, and converts point cloud data into sparse tensors to reduce computational complexity.
[0173] Standardization and normalization: Standardization and normalization are performed on sensor data to ensure that inputs from different data sources have consistent distribution and dimensions to avoid affecting the accuracy of subsequent model reasoning.
[0174] Through these preprocessing steps, the system ensures the quality and consistency of the input data, laying a solid foundation for subsequent model reasoning.
[0175] 2. Model parsing module: Autonomous driving systems usually use complex deep learning models, such as convolutional neural networks (CNN), recurrent neural networks (RNN), 3D convolutional networks (3D CNN) and graph neural networks (GNN). These models need to process multimodal and high-dimensional data. The specific functions of the model parsing module are as follows:
[0176] Model structure analysis and optimization: Analyze the network structure of various models, such as convolutional layers, pooling layers, fully connected layers, etc. The module will analyze the computational complexity of the model and perform necessary optimizations, such as pruning unimportant connections or layers to reduce computational overhead.
[0177] Parameter loading and allocation: The model parsing module extracts weight parameters from the pre-trained model file and reasonably allocates computing tasks according to the distribution of hardware resources. For example, in a multi-GPU system, the module will split the model parameters to each GPU for parallel computing.
[0178] Model adjustment and customization: According to the task requirements of autonomous driving (such as lane detection and obstacle recognition), the module will customize the model, such as adding a dedicated feature extraction module to ensure that the model can adapt to different environmental changes and complex road conditions.
[0179] Through in-depth analysis and optimization of the model, the system can make full use of hardware resources, improve reasoning efficiency, and reduce unnecessary computing delays.
[0180] 3. Hardware detection module: In autonomous driving systems, the role of the hardware detection module is particularly important because autonomous driving usually runs on resource-constrained edge devices, and the performance of these devices directly affects the speed and effect of reasoning. The main functions of this module are as follows:
[0181] Real-time performance monitoring: Continuously monitor the usage of hardware resources, such as CPU / GPU utilization, memory usage, etc., and evaluate the available performance of the hardware in real time. Based on the monitoring results, the module can dynamically adjust the model's operation strategy, such as enabling a lightweight version of the model when computing resources are insufficient.
[0182] Hardware feature analysis: Analyze the characteristics of the hardware, such as the number of cores and frequency of the graphics processor, the parallel processing capability of the embedded accelerator, etc. This module will select the most suitable computing mode based on the hardware characteristics, such as CPU and GPU working together, or enabling a dedicated AI acceleration chip.
[0183] Equipment redundancy and fault detection: In autonomous driving systems, hardware reliability is crucial. The hardware detection module uses multiple redundant detection mechanisms to ensure that the device can quickly switch to backup hardware when a fault occurs, avoiding interruptions in the reasoning process.
[0184] Through real-time performance monitoring and hardware feature analysis, the hardware detection module ensures that the model can run stably and efficiently on edge devices.
[0185] 4. Model deployment module: In autonomous driving, the model deployment module is responsible for deploying the optimized model to the vehicle's computing platform and making corresponding adjustments based on the hardware configuration. The specific deployment strategy is as follows:
[0186] Multi-task parallel deployment: The autonomous driving system needs to handle multiple tasks simultaneously, such as target detection, lane keeping, path planning, etc. The model deployment module deploys models of different tasks on different computing units through task division and parallel execution strategies, and utilizes the parallel capabilities of multi-core processors or multi-GPUs to greatly improve the system's response speed.
[0187] Dynamic model switching: In different driving scenarios (such as highways and urban roads), the system may need different models to cope with them. Therefore, the model deployment module has designed a dynamic model switching mechanism that can automatically load and switch the most appropriate model version according to the current driving environment.
[0188] Memory optimization and cache management: Due to the limited memory resources of the autonomous driving system, the model deployment module will perform targeted memory optimization, such as using memory compression technology to reduce memory usage. At the same time, through the cache management mechanism, commonly used model weights and intermediate calculation results are cached to improve data reading efficiency.
[0189] These measures enable the model to run efficiently on the computing platform of the autonomous vehicle, ensuring the vehicle's real-time responsiveness in complex driving environments.
[0190] 5. Model acceleration module: The model acceleration module plays a vital role in autonomous driving. It uses a variety of technical means to improve the model's reasoning speed to meet the needs of real-time driving. Specific optimization technologies include:
[0191] Hardware accelerator optimization: For hardware accelerators commonly used in autonomous driving (such as NVIDIA Xavier and Intel Movidius), the model acceleration module will specifically optimize the inference process. For example, it can improve the computing speed through low-precision calculations (such as INT8 quantization), or optimize the calculation graph through deep learning acceleration libraries (such as TensorRT).
[0192] Pipeline parallelism and distributed computing: The model acceleration module is designed with a pipeline parallel processing mechanism, which decomposes the reasoning process into multiple independent computing stages (such as feature extraction, target detection, and path planning) and executes them in parallel on multiple computing units. In addition, on an autonomous driving platform with multiple computing nodes, the module can further accelerate the reasoning process through distributed computing.
[0193] Sparsification and pruning: For some models with high redundancy (such as large-scale convolutional networks), the module will perform sparsification processing to prune unimportant neuron connections, thereby reducing the amount of computation and improving the inference speed.
[0194] Through these acceleration technologies, the model acceleration module significantly improves the real-time reasoning capabilities of the autonomous driving system, ensuring that the vehicle can respond promptly to rapidly changing road environments.
[0195] 6. Model reasoning module: The model reasoning module of autonomous driving is the core of the entire system, responsible for real-time reasoning of input data and generating driving decisions. Its workflow is as follows:
[0196] Perception reasoning: Receives data from sensors such as cameras and radars, and performs perception reasoning through deep learning models, such as target detection, object recognition, obstacle detection, etc. The results of perception reasoning directly affect the vehicle's driving decisions.
[0197] Path planning and control reasoning: After obtaining the perception reasoning results, the system needs to perform path planning and predict the future driving trajectory. The model reasoning module combines real-time map information with perception data to generate the optimal path and convert it into specific control instructions, such as acceleration, braking, steering, etc.
[0198] Low-latency execution: Autonomous driving has extremely high latency requirements. The model reasoning module optimizes the reasoning path and acceleration algorithm to ensure that the system completes reasoning and decision-making at the millisecond level to avoid traffic accidents.
[0199] The model reasoning module provides real-time decision-making capabilities for the autonomous driving system, enabling the vehicle to operate safely and efficiently in complex driving environments.
[0200] 7. Post-processing module: In the autonomous driving system, the post-processing module is responsible for optimizing and adjusting the results generated by the inference module to ensure that the vehicle can execute correctly. Specific operations include:
[0201] Result fusion and filtering: The post-processing module integrates information from different sensors (such as lidar and camera) through multi-sensor data fusion technology to improve the robustness of perception results. For example, if the camera and lidar detect an object at the same location, the existence of the object can be confirmed and its type can be determined; if there is a conflict between sensors, the final result may need to be determined based on confidence or historical data.
[0202] Decision output: After completing the processing of the perception results, the post-processing module will pass the generated optimization results to the decision control system. At this time, the system will generate more accurate control instructions based on the processed perception information and pass them to the vehicle's execution module (such as steering wheel, accelerator, brake, etc.) through the interface to ensure that the vehicle can respond correctly to environmental changes.
[0203] 8. Result output module: The result output module is responsible for converting the final inference results optimized by the post-processing module into control commands suitable for execution and passing them to the vehicle's actuators. The core functions of this module include:
[0204] Control command generation: Based on the perception and decision results optimized by the post-processing module, specific control commands are generated, such as steering angle, acceleration or braking force, lane change request, etc. These control commands will take into account multiple factors such as current road conditions, vehicle speed, obstacle location, etc. to ensure safe and smooth driving of the vehicle.
[0205] Multi-task coordination and priority management: During the autonomous driving process, the system may receive multiple task requests at the same time, such as emergency braking, obstacle avoidance, overtaking, etc. The result output module coordinates the execution order of different tasks through the priority management mechanism to ensure that emergency tasks are handled first, thereby improving the system's emergency response capabilities.
[0206] Feedback and adaptive adjustment: The result output module also monitors the feedback information after executing the command, such as the deviation between the actual motion state of the vehicle and the predicted result. If a large deviation is found, the module will dynamically adjust the control command or recalculate the path to correct the vehicle's driving trajectory.
[0207] The present invention has shown and described the basic principles and main features of the present invention and the advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The above embodiments and descriptions are only for explaining the principles of the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, which fall within the scope of the present invention. The scope of protection of the present invention is defined by the attached claims and their equivalents.
Claims
1. An end-to-end model reasoning acceleration system, characterized in that: Includes the following modules: Data preprocessing module: preprocesses the original input data and converts it into a format suitable for model processing; Model parsing module: parses the input deep learning model in detail to ensure that the model is correctly loaded and adapted to the target hardware environment; Hardware detection module: detects the performance parameters of the current hardware and provides the hardware information required for model deployment; Model deployment module: deploys the model to the target hardware and adjusts the model's inference path and parameter settings according to the hardware configuration, including: Model loading and adaptation: Load the parsed model into memory and adapt it according to the hardware information provided by the hardware detection module; Run path optimization: optimize the model's calculation path according to hardware characteristics and select the optimal calculation graph execution order; Parameter tuning and configuration: Adjust the batch size and number of parallel computing threads of the model according to the computing power and memory capacity of the hardware; Model acceleration module: optimizes and accelerates the deployed model, including: Operator fusion: Multiple computing operators in the model are merged into one operator, including: In convolutional neural networks, the convolution operation is combined with the batch normalization calculation step; For models with multiple linear layers or matrix multiplication operations, merge the computations of adjacent layers; Computational graph optimization: Rearrange or simplify the calculation order by analyzing the model's computational graph; Hardware acceleration utilization: Optimization algorithms specifically designed for hardware accelerator applications; Low-precision calculation: Mixed-precision calculation is used while ensuring the accuracy of the model; Model inference module: receives input data from the data preprocessing module, uses the accelerated model to perform inference, and generates preliminary inference results; Post-processing module: processes and optimizes the preliminary reasoning results generated by the model reasoning module; Result output module: outputs the final post-processed results to users or downstream application systems according to the application scenario.
2. The end-to-end model reasoning acceleration system according to claim 1, characterized in that: The data preprocessing module preprocesses the original input data including: Format conversion: converting various raw data types into the input format required by the model; Data normalization: Normalize the data according to the model requirements and normalize the text embedding vector; Noise filtering and data enhancement: Perform denoising, blurring, and data enhancement on image data.
3. The end-to-end model reasoning acceleration system according to claim 2, characterized in that: The raw input data includes text, images, videos, audio and sensor data.
4. The end-to-end model reasoning acceleration system according to claim 1, characterized in that: The model parsing module performs detailed parsing of the input deep learning model including: Model structure analysis: extract the hierarchical structure of the model and determine the dependencies between layers; Parameter extraction and verification: extract weight parameters from the model file and verify the consistency and integrity of the parameters; Feedback mechanism: Based on the parsed model structure, the input data format requirements are fed back to the data preprocessing module.
5. The end-to-end model reasoning acceleration system according to claim 1, characterized in that: The model reasoning module specifically includes: Efficient reasoning execution: Use the optimized model to quickly reason about input data; Multi-task support: supports parallel execution of multiple reasoning tasks to meet the needs of various application scenarios; Inference result cache: caches frequently used inference results.
6. The end-to-end model reasoning acceleration system according to claim 1, characterized in that: The post-processing module processes and optimizes the preliminary reasoning results generated by the model reasoning module, specifically including: Denormalization and decoding: Denormalize the preliminary inference results and convert them into the numerical range of the original data space, and perform decoding operations at the same time; Format conversion: convert the inference results into a format that meets application requirements; Result screening and optimization: The inference results are screened according to the set thresholds or rules, and the prediction results that do not meet the requirements are eliminated.
7. The end-to-end model reasoning acceleration system according to claim 1, characterized in that: The output forms of the result output module include classification label output, regression value output, detection box output and decision result output.
Citation Information
Patent Citations
Deep learning model reasoning method and device, equipment and storage medium
CN115600676A
Deep learning model acceleration system facing edge device and acceleration method thereof
CN117744740A
Rapid reasoning method, device and system for large language model of smart phone
CN118446321A