Neural Network Compilation via Pre-trained Optimization Model
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current methods for compiling neural network models are inefficient due to long compilation times and low efficiency, primarily because they rely on heuristic algorithms to find optimal optimization solutions, which require extensive traversal times.
Innovation Solution
A method and apparatus that utilize a pre-trained instruction sequence optimization model to quickly determine optimal optimization parameters for intermediate instruction sequences, converting them into executable sequences for neural network processors, thereby reducing compilation time and improving efficiency.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If a heuristic algorithm is used to traverse various optimization solutions to find an optimal optimization solution, then the model execution efficiency is improved, but the compilation time is significantly extended
Solution Approach 1:
The patent pre-generates multiple optimization instruction sequences in advance and stores them in a lookup table during the compiler initialization phase. When compiling a neural network model, the system directly queries the pre-generated optimization sequences based on the intermediate representation characteristics, eliminating the need for real-time heuristic traversal and significantly reducing compilation time while maintaining optimal execution efficiency.
2Manufacturing precision
If manual rule formulation and heuristic algorithm traversal are used to identify optimizable parts, then optimization accuracy is improved, but compilation complexity increases
Solution Approach 1:
The patent creates a lookup table that stores pre-computed optimization instruction sequences as templates. Instead of performing complex heuristic traversal during compilation, the system copies appropriate pre-generated optimization sequences from the lookup table based on matching criteria, thereby reducing compilation complexity while preserving optimization accuracy through the use of pre-validated optimization patterns.
3Reliability
If extensive traversal of optimization solutions is performed, then the optimal optimization solution is found, but the processing time is significantly increased
Solution Approach 1:
The system performs the exhaustive traversal and validation of optimization solutions in advance during compiler initialization, storing the results in a lookup table. During actual model compilation, it directly retrieves pre-validated optimization sequences through simple query operations, ensuring high solution quality while reducing processing time to minimal lookup operations.
Data Source
AI summary
Embodiments of this disclosure provide a method and apparatus for compiling a neural network model, and a method and an apparatus for training an optimization model. The method includes: obtaining a to-be-compiled neural network model; determining an intermediate instruction sequence corresponding to the to-be-compiled neural network model based on the to-be-compiled neural network model; processing the intermediate instruction sequence by using a pre-trained instruction sequence optimization model, to obtain a target optimization parameter corresponding to the intermediate instruction sequence; determining an optimization instruction sequence corresponding to the intermediate instruction sequence based on the target optimization parameter; and converting the optimization instruction sequence into an executable instruction sequence, to obtain a target instruction sequence that is executable by a neural network processor corresponding to the to-be-compiled neural network model. According to the embodiments of this disclosure, compilation time can be greatly reduced, thereby effectively improving compilation efficiency.


