KR102462001B1 - Method, device, and system for optimizing a neural network model to be executed on imbedded device - Google Patents
Method, device, and system for optimizing a neural network model to be executed on imbedded device Download PDFInfo
- Publication number
- KR102462001B1 KR102462001B1 KR1020220023380A KR20220023380A KR102462001B1 KR 102462001 B1 KR102462001 B1 KR 102462001B1 KR 1020220023380 A KR1020220023380 A KR 1020220023380A KR 20220023380 A KR20220023380 A KR 20220023380A KR 102462001 B1 KR102462001 B1 KR 102462001B1
- Authority
- KR
- South Korea
- Prior art keywords
- neural network
- network model
- information
- optimization
- embedded device
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/06—Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons
- G06N3/063—Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons using electronic means
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Health & Medical Sciences (AREA)
- Life Sciences & Earth Sciences (AREA)
- Biomedical Technology (AREA)
- Biophysics (AREA)
- General Health & Medical Sciences (AREA)
- General Physics & Mathematics (AREA)
- Evolutionary Computation (AREA)
- Computational Linguistics (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Artificial Intelligence (AREA)
- Neurology (AREA)
- Image Analysis (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
Description
본 출원은 신경망 모델 최적화 방법, 신경망 모델 최적화 장치, 및 신경망 모델 최적화 시스템에 관한 것이다. 구체적으로 본 출원은 임베디드 장치에서 실행될 신경망 모델을 최적화하는 방법, 장치, 및 시스템에 관한 것이다. The present application relates to a method for optimizing a neural network model, an apparatus for optimizing a neural network model, and a system for optimizing a neural network model. Specifically, the present application relates to a method, apparatus, and system for optimizing a neural network model to be executed in an embedded device.
인공지능 기술이 발전하면서 다양한 산업 분야에서 활용되는 임베디드 시스템이 내재된 임베디드 장치에 인공지능 기술이 접목되는 것이 요구되고 있다. 이에 따라 경량화 기술들이 개발되었고 저성능, 저사양인 임베디드 장치들에 인공지능 기술이 접목될 수 있게 되었다. 특히, 미리 학습이 완료된 인공지능 모델을 임베디드 장치에 최대한 효율적으로 실행시키도록 개발된 소프트웨어인 실행 엔진(Inference Engine) 기술을 통하여 임베디드 장치에 인공지능 기술이 접목될 수 있게 되었다.As artificial intelligence technology develops, it is required to incorporate artificial intelligence technology into embedded devices with embedded systems used in various industrial fields. Accordingly, lightweight technologies have been developed, and artificial intelligence technology can be applied to low-performance, low-spec embedded devices. In particular, AI technology can be applied to embedded devices through Inference Engine technology, which is software developed to execute pre-trained AI models as efficiently as possible on embedded devices.
종래의 임베디드용 인공지능 실행 엔진은 임베디드 장치 자체에서 모델의 실행에 대한 정보를 읽고, 모델 실행 순서를 설정하고, 모델 실행에 필요한 메모리를 할당하여 모델을 실행하는 방식을 채택하고 있었다. 다만, 메모리 공간에 제약이 존재하는 임베디드 장치 자체에서 전술한 모델 실행을 위한 준비 과정들을 실행하는 것은 임베디드 장치의 하드웨어 환경에 상당한 부담을 야기하였다.The conventional AI execution engine for embedded reads information about the execution of the model from the embedded device itself, sets the model execution order, and allocates the memory required for the model execution to execute the model. However, executing the above-described preparation processes for model execution in the embedded device itself having a memory space constraint causes a significant burden on the hardware environment of the embedded device.
또한, 종래의 임베디드용 인공지능 실행 엔진은 비표준화된 하드웨어 요구사항에 대한 최적화를 위하여는 추가적인 수작업이 요구된다는 문제가 존재하였다. 구체적으로 종래의 임베디드용 인공지능 실행 엔진은, 각 하드웨어의 특수 명령어를 이용하거나, For Loop Unrolling 등의 최적화 기술을 이용하기 위하여 엔진 코드를 일일이 수작업으로 수정해야 하는 제약이 존재였다. 즉 종래의 임베디드용 인공지능 실행 엔진은 특정 하드웨어에만 최적화될 수 있었으며, 특정 하드웨어 이외의 하드웨어에서 실제로 사용하기 위하여는 수작업으로 실행 함수들을 최적화하는 과정이 필수적으로 요구되었다. In addition, the conventional AI execution engine for embedded has a problem that additional manual work is required to optimize for non-standard hardware requirements. Specifically, the conventional AI execution engine for embedded has a limitation in that it is necessary to manually modify the engine code one by one in order to use a special instruction of each hardware or to use an optimization technology such as For Loop Unrolling. That is, the conventional AI execution engine for embedded could be optimized only for specific hardware, and in order to actually use it in hardware other than specific hardware, the process of optimizing the execution functions by hand was essential.
이에, 인공지능 모델 및 임베디드 장치의 하드웨어 정보(컴퓨팅 사양)에 기초하여 신경망 모델을 임베디드 장치에서 최적으로 실행하기 위한 신경망 모델 최적화 방법, 장치 및 시스템의 개발이 요구된다.Accordingly, it is required to develop a neural network model optimization method, apparatus, and system for optimally executing a neural network model in an embedded device based on an artificial intelligence model and hardware information (computing specifications) of the embedded device.
본 발명이 해결하고자 하는 일 과제는, 임베디드 장치의 하드웨어 정보를 고려하여 신경망 모델을 임베디드 장치에서 최적으로 실행하기 위한 신경망 모델 최적화 방법, 신경망 모델 최적화 장치 및 신경망 모델 최적화 시스템을 제공하는 것이다. An object of the present invention is to provide a neural network model optimization method, a neural network model optimization device, and a neural network model optimization system for optimally executing a neural network model in an embedded device in consideration of hardware information of the embedded device.
본 발명이 해결하고자 하는 과제가 상술한 과제로 제한되는 것은 아니며, 언급되지 아니한 과제들은 본 명세서 및 첨부된 도면으로부터 본 발명이 속하는 기술분야에서 통상의 지식을 가진 자에게 명확하게 이해될 수 있을 것이다.The problem to be solved by the present invention is not limited to the above-described problems, and the problems not mentioned will be clearly understood by those of ordinary skill in the art to which the present invention belongs from the present specification and the accompanying drawings. .
본 출원의 일 실시예에 따른 신경망 모델 최적화 방법은, 학습이 완료된 신경망 모델의 실행 데이터를 획득하는 단계-상기 실행 데이터는 상기 신경망 모델의 계층 데이터, 상기 신경망 모델을 구성하는 연산 데이터(operation data), 및 상기 신경망 모델의 파라미터 중 적어도 하나를 포함함-; 상기 신경망 모델의 실행 데이터에 기초하여 상기 신경망 모델의 구조에 대한 최적화를 수행하고 인스트럭션 정보를 획득하는 단계; 상기 인스트럭션 정보에 기초하여 상기 신경망 모델이 구동될 임베디드 장치에 대한 최적화를 수행하고 최적 코드 정보를 획득하는 단계; 및 상기 최적 코드 정보를 송신하는 단계;를 포함하되, 상기 신경망 모델의 구조에 대한 최적화를 수행하고 인스트럭션 정보를 획득하는 단계는, 상기 실행 데이터에 기초하여 방향성 비사이클 그래프(DAG)를 생성하는 단계; 상기 방향성 비사이클 그래프에 기초하여 연산들의 실행 순서를 결정하는 단계; 미리 정해진 기준 연산 패턴에 기초하여 상기 기준 연산 패턴에 대응되는 상기 방향성 비사이클 그래프의 대상 연산 패턴을 검출하고, 상기 대상 연산 패턴에 포함된 제1 대상 연산과 제2 대상 연산을 병합하는 단계; 상기 결정된 실행 순서에 기초하여 제1 메모리 공간 맵을 획득하고, 상기 제1 메모리 공간 맵에 기초하여 메모리 할당과 관련된 최적화를 수행하는 단계; 및 최적화 수행 결과에 기초하여 메모리 주소와 관련된 인스트럭션을 생성하는 단계;를 더 포함할 수 있다. The method for optimizing a neural network model according to an embodiment of the present application includes: acquiring execution data of a neural network model on which learning is completed - The execution data is hierarchical data of the neural network model, operation data constituting the neural network model , and at least one of the parameters of the neural network model; performing optimization on the structure of the neural network model based on the execution data of the neural network model and obtaining instruction information; performing optimization on an embedded device in which the neural network model is to be driven based on the instruction information and obtaining optimal code information; and transmitting the optimal code information; wherein, performing optimization on the structure of the neural network model and obtaining instruction information includes: generating a directional acyclic graph (DAG) based on the execution data ; determining an execution order of operations based on the directed acyclic graph; detecting a target operation pattern of the directional acyclic graph corresponding to the reference operation pattern based on a predetermined reference operation pattern, and merging the first target operation and the second target operation included in the target operation pattern; obtaining a first memory space map based on the determined execution order, and performing optimization related to memory allocation based on the first memory space map; and generating an instruction related to a memory address based on the optimization result.
본 출원의 일 실시예에 따른 신경망 모델 최적화 장치는, 학습이 완료된 신경망 모델의 실행 데이터 및 신경망 모델이 구동될 임베디드 장치의 컴퓨팅 환경 정보를 획득하는 송수신부; 및 상기 실행 데이터 및 상기 임베디드 장치의 컴퓨팅 환경 정보에 기초하여 상기 신경망 모델에 대한 최적화를 수행하는 프로세서;를 포함하되, 상기 프로세서는, 학습이 완료된 신경망 모델의 실행 데이터-상기 실행 데이터는 상기 신경망 모델의 계층 데이터, 상기 신경망 모델을 구성하는 연산 데이터(operation data), 및 상기 신경망 모델의 파라미터 중 적어도 하나를 포함함-를 획득하고, 상기 신경망 모델의 실행 데이터에 기초하여 상기 신경망 모델의 구조에 대한 최적화를 수행하고 인스트럭션 정보를 획득하고, 상기 인스트럭션 정보에 기초하여 상기 신경망 모델이 구동될 임베디드 장치에 대한 최적화를 수행하고 최적 코드 정보를 획득하고, 상기 최적 코드 정보를 송신하도록 구성되되, 상기 프로세서는, 상기 실행 데이터에 기초하여 방향성 비사이클 그래프(DAG)를 생성하고, 상기 방향성 비사이클 그래프에 기초하여 연산들의 실행 순서를 결정하고, 미리 정해진 기준 연산 패턴에 기초하여 상기 기준 연산 패턴에 대응되는 상기 방향성 비사이클 그래프의 대상 연산 패턴을 검출하고, 상기 대상 연산 패턴에 포함된 제1 대상 연산과 제2 대상 연산을 병합하고, 상기 결정된 실행 순서에 기초하여 제1 메모리 공간 맵을 획득하고, 상기 제1 메모리 공간 맵에 기초하여 메모리 할당과 관련된 최적화를 수행하고, 최적화 수행 결과에 기초하여 메모리 주소와 관련된 인스트럭션을 생성함으로써, 상기 인스트럭션 정보를 획득하도록 구성될 수 있다. An apparatus for optimizing a neural network model according to an embodiment of the present application includes: a transceiver for acquiring execution data of a neural network model that has been trained and computing environment information of an embedded device in which the neural network model is to be driven; and a processor for performing optimization on the neural network model based on the execution data and computing environment information of the embedded device, wherein the processor includes: execution data of a neural network model that has been trained - the execution data is the neural network model obtain hierarchical data of , operation data constituting the neural network model, and at least one of parameters of the neural network model; and, based on the execution data of the neural network model, configured to perform optimization and obtain instruction information, perform optimization on an embedded device in which the neural network model is to be driven based on the instruction information, obtain optimal code information, and transmit the optimal code information, wherein the processor comprises: , generates a directional acyclic graph (DAG) based on the execution data, determines an execution order of operations based on the directional acyclic graph, and corresponds to the reference operation pattern based on a predetermined reference operation pattern Detect a target operation pattern of a directed acyclic graph, merge a first target operation and a second target operation included in the target operation pattern, obtain a first memory space map based on the determined execution order, and 1 may be configured to obtain the instruction information by performing optimization related to memory allocation based on the memory space map and generating an instruction related to a memory address based on a result of performing the optimization.
본 출원의 일 실시예에 따른 신경망 모델 최적화 방법은, 학습이 완료된 신경망 모델의 실행 데이터를 획득하는 단계-상기 실행 데이터는 상기 신경망 모델의 계층 데이터, 상기 신경망 모델을 구성하는 연산 데이터(operation data) 및 상기 신경망 모델의 파라미터 중 적어도 하나를 포함함-; 상기 신경망 모델의 실행 데이터에 기초하여 상기 신경망 모델의 구조에 대한 최적화를 수행하고 인스트럭션 정보를 획득하는 단계-상기 인스트럭션 정보는 연산의 유형, 연산의 및 메모리 주소 중 적어도 하나와 관련된 정보를 포함함-; 상기 인스트럭션 정보에 기초하여 상기 신경망 모델이 구동될 임베디드 장치에 대한 최적화를 수행하고 최적 코드 정보를 획득하는 단계; 및 상기 최적 코드 정보를 송신하는 단계;를 포함하되, 상기 최적 코드 정보를 획득하는 단계는, 상기 임베디드 장치의 컴퓨팅 환경 정보를 획득하는 단계; 강화 학습으로 훈련된 에이전트를 통하여, 인스트럭션 정보로부터 최적화 파라미터를 획득하는 단계; 및 상기 최적화 파라미터에 기초하여 상기 임베디드 장치에서 이용될 코드 정보를 생성하는 단계;를 더 포함할 수 있다. The method for optimizing a neural network model according to an embodiment of the present application includes: acquiring execution data of a neural network model on which learning is completed - The execution data is hierarchical data of the neural network model, operation data constituting the neural network model and at least one of the parameters of the neural network model; performing optimization on the structure of the neural network model and obtaining instruction information based on the execution data of the neural network model, wherein the instruction information includes information related to at least one of a type of operation, a description of the operation, and a memory address- ; performing optimization on an embedded device in which the neural network model is to be driven based on the instruction information and obtaining optimal code information; and transmitting the optimal code information; wherein the acquiring of the optimal code information includes: acquiring computing environment information of the embedded device; obtaining optimization parameters from instruction information through an agent trained by reinforcement learning; and generating code information to be used in the embedded device based on the optimization parameter.
본 출원의 일 실시예에 따른 신경망 모델 최적화 장치는, 학습이 완료된 신경망 모델의 실행 데이터 및 신경망 모델이 구동될 임베디드 장치의 컴퓨팅 환경 정보를 획득하는 송수신부; 및 상기 실행 데이터 및 상기 임베디드 장치의 컴퓨팅 환경 정보에 기초하여 상기 신경망 모델에 대한 최적화를 수행하는 프로세서;를 포함하되, 상기 프로세서는, 학습이 완료된 신경망 모델의 실행 데이터-상기 실행 데이터는 상기 신경망 모델의 계층 데이터, 상기 신경망 모델을 구성하는 연산 데이터(operation data), 및 상기 신경망 모델의 파라미터 중 적어도 하나를 포함함-를 획득하고, 상기 신경망 모델의 실행 데이터에 기초하여 상기 신경망 모델의 구조에 대한 최적화를 수행하고 인스트럭션 정보-상기 인스트럭션 정보는 연산의 유형, 및 메모리 주소 중 적어도 하나와 관련된 정보를 포함함-를 획득하고, 상기 인스트럭션 정보에 기초하여 상기 신경망 모델이 구동될 임베디드 장치에 대한 최적화를 수행하고 최적 코드 정보를 획득하고, 상기 최적 코드 정보를 송신하도록 구성되되, 상기 프로세서는, 상기 임베디드 장치의 컴퓨팅 환경 정보를 획득하고, 강화 학습으로 훈련된 에이전트를 통하여, 인스트럭션 정보로부터 최적화 파라미터를 획득하고, 상기 최적화 파라미터에 기초하여 상기 임베디드 장치에서 이용될 코드 정보를 생성함으로써 상기 최적 코드 정보를 획득하도록 구성될 수 있다. An apparatus for optimizing a neural network model according to an embodiment of the present application includes: a transceiver for acquiring execution data of a neural network model that has been trained and computing environment information of an embedded device in which the neural network model is to be driven; and a processor for performing optimization on the neural network model based on the execution data and computing environment information of the embedded device, wherein the processor includes: execution data of a neural network model that has been trained - the execution data is the neural network model obtain hierarchical data of , operation data constituting the neural network model, and at least one of parameters of the neural network model; and, based on the execution data of the neural network model, Perform optimization and obtain instruction information, wherein the instruction information includes information related to at least one of a type of operation and a memory address, and optimize an embedded device in which the neural network model is to be driven based on the instruction information. and obtain optimal code information, and send the optimal code information, wherein the processor acquires computing environment information of the embedded device, and through an agent trained in reinforcement learning, obtains optimization parameters from the instruction information and to obtain the optimal code information by generating code information to be used in the embedded device based on the optimization parameter.
본 발명의 과제의 해결 수단이 상술한 해결 수단들로 제한되는 것은 아니며, 언급되지 아니한 해결 수단들은 본 명세서 및 첨부된 도면으로부터 본 발명이 속하는 기술분야에서 통상의 지식을 가진 자에게 명확하게 이해될 수 있을 것이다.The solutions to the problems of the present invention are not limited to the above-described solutions, and solutions not mentioned will be clearly understood by those of ordinary skill in the art to which the present invention belongs from the present specification and the accompanying drawings. will be able
본 출원의 실시예에 따른 신경망 모델 최적화 방법, 신경망 모델 최적화 장치, 및 신경망 모델 최적화 시스템에 의하면, 임베디드 장치의 하드웨어의 비표준화 문제와 기존 인공지능 실행 엔진의 구조적인 제약을 해결하고, 신경망 모델을 임베디드 장치의 하드웨어 플랫폼에 대하여 최적화시킬 수 있다. According to the neural network model optimization method, the neural network model optimization apparatus, and the neural network model optimization system according to the embodiments of the present application, the problem of hardware non-standardization of embedded devices and the structural constraints of the existing artificial intelligence execution engine are solved, and the neural network model is It can be optimized for the hardware platform of the embedded device.
본 출원의 실시예에 따른 신경망 모델 최적화 방법, 신경망 모델 최적화 장치, 및 신경망 모델 최적화 시스템에 의하면, 임베디드 장치에서의 신경망 모델의 실행 능력이 향상될 수 있다.According to the method for optimizing a neural network model, the apparatus for optimizing a neural network model, and the system for optimizing a neural network model according to an embodiment of the present application, execution capability of a neural network model in an embedded device may be improved.
본 출원의 실시예에 따른 신경망 모델 최적화 방법, 신경망 모델 최적화 장치, 및 신경망 모델 최적화 시스템에 의하면, 임베디드 장치에서 신경망 모델을 실행시키기 위하여 필요한 전력 사용량을 감소시킬 수 있다. According to the method for optimizing a neural network model, the apparatus for optimizing a neural network model, and the system for optimizing a neural network model according to an embodiment of the present application, it is possible to reduce the amount of power required to execute a neural network model in an embedded device.
본 발명의 효과가 상술한 효과들로 제한되는 것은 아니며, 언급되지 아니한 효과들은 본 명세서 및 첨부된 도면으로부터 본 발명이 속하는 기술분야에서 통상의 지식을 가진 자에게 명확히 이해될 수 있을 것이다.Effects of the present invention are not limited to the above-described effects, and effects not mentioned will be clearly understood by those of ordinary skill in the art to which the present invention belongs from the present specification and accompanying drawings.
도 1은 본 출원의 일 실시예에 따른 신경망 모델 최적화 시스템의 개략도이다.
도 2는 본 출원의 일 실시예에 따른 신경망 모델 최적화 방법을 나타낸 순서도이다.
도 3은 본 출원의 일 실시예에 따른 신경망 모델의 구조에 대한 최적화를 수행하고 인스트럭션 정보를 획득하는 단계를 구체화한 순서도이다.
도 4는 본 출원의 일 실시예에 따른 방향성 비사이클 그래프의 일 양상을 도시한 도면이다.
도 5는 본 출원의 일 실시예에 따른 제1 대상 연산과 제2 대상 연산을 병합하는 일 양상을 도시한 도면이다.
도 6은 본 출원의 일 실시예에 따른 제1 메모리 공간 맵의 일 양상을 도시한 도면이다.
도 7은 본 출원의 일 실시예에 따른 메모리 할당과 관련된 최적화의 일 양상을 도시한 도면이다.
도 8은 본 출원의 일 실시예에 따른 임베디드 장치에 대한 최적화를 수행하고 최적 코드 정보를 획득하는 단계를 구체화한 순서도이다.
도 9는 본 출원의 일 실시예에 따른 강화 학습 방식을 통하여 에이전트를 훈련시키는 일 양상을 도시한 도면이다. 1 is a schematic diagram of a neural network model optimization system according to an embodiment of the present application.
2 is a flowchart illustrating a method for optimizing a neural network model according to an embodiment of the present application.
3 is a flowchart detailing the steps of performing optimization on the structure of a neural network model and acquiring instruction information according to an embodiment of the present application.
4 is a diagram illustrating an aspect of a directional acyclic graph according to an embodiment of the present application.
5 is a diagram illustrating an aspect of merging a first target operation and a second target operation according to an embodiment of the present application.
6 is a diagram illustrating an aspect of a first memory space map according to an embodiment of the present application.
7 is a diagram illustrating an aspect of optimization related to memory allocation according to an embodiment of the present application.
8 is a flowchart detailing the steps of performing optimization on an embedded device and acquiring optimal code information according to an embodiment of the present application.
9 is a diagram illustrating an aspect of training an agent through a reinforcement learning method according to an embodiment of the present application.
본 출원의 상술한 목적, 특징들 및 장점은 첨부된 도면과 관련된 다음의 상세한 설명을 통해 보다 분명해질 것이다. 다만, 본 출원은 다양한 변경을 가할 수 있고 여러 가지 실시예들을 가질 수 있는 바, 이하에서는 특정 실시예들을 도면에 예시하고 이를 상세히 설명하고자 한다.The above-mentioned objects, features and advantages of the present application will become more apparent from the following detailed description in conjunction with the accompanying drawings. However, since the present application may have various changes and may have various embodiments, specific embodiments will be exemplified in the drawings and described in detail below.
명세서 전체에 걸쳐서 동일한 참조번호들은 원칙적으로 동일한 구성요소들을 나타낸다. 또한, 각 실시예의 도면에 나타나는 동일한 사상의 범위 내의 기능이 동일한 구성요소는 동일한 참조부호를 사용하여 설명하며, 이에 대한 중복되는 설명은 생략하기로 한다.Throughout the specification, like reference numerals refer to like elements in principle. In addition, components having the same function within the scope of the same idea shown in the drawings of each embodiment will be described using the same reference numerals, and overlapping descriptions thereof will be omitted.
본 출원과 관련된 공지 기능 혹은 구성에 대한 구체적인 설명이 본 출원의 요지를 불필요하게 흐릴 수 있다고 판단되는 경우 그 상세한 설명을 생략한다. 또한, 본 명세서의 설명 과정에서 이용되는 숫자(예를 들어, 제1, 제2 등)는 하나의 구성요소를 다른 구성요소와 구분하기 위한 식별기호에 불과하다.If it is determined that a detailed description of a known function or configuration related to the present application may unnecessarily obscure the gist of the present application, the detailed description thereof will be omitted. In addition, numbers (eg, first, second, etc.) used in the description process of the present specification are merely identification symbols for distinguishing one component from other components.
또한, 이하의 실시예에서 사용되는 구성요소에 대한 접미사 "모듈" 및 "부"는 명세서 작성의 용이함만이 고려되어 부여되거나 혼용되는 것으로서, 그 자체로 서로 구별되는 의미 또는 역할을 갖는 것은 아니다.In addition, the suffixes "module" and "part" for the components used in the following embodiments are given or mixed in consideration of only the ease of writing the specification, and do not have distinct meanings or roles by themselves.
이하의 실시예에서, 단수의 표현은 문맥상 명백하게 다르게 뜻하지 않는 한, 복수의 표현을 포함한다.In the following examples, the singular expression includes the plural expression unless the context clearly dictates otherwise.
이하의 실시예에서, 포함하다 또는 가지다 등의 용어는 명세서상에 기재된 특징, 또는 구성요소가 존재함을 의미하는 것이고, 하나 이상의 다른 특징들 또는 구성요소가 부가될 가능성을 미리 배제하는 것은 아니다.In the following embodiments, terms such as include or have means that the features or components described in the specification are present, and the possibility that one or more other features or components may be added is not excluded in advance.
도면에서는 설명의 편의를 위하여 구성 요소들이 그 크기가 과장 또는 축소될 수 있다. 예컨대, 도면에서 나타난 각 구성의 크기 및 두께는 설명의 편의를 위해 임의로 나타낸 것으로, 본 발명이 반드시 도시된 바에 한정되지 않는다.In the drawings, the size of the components may be exaggerated or reduced for convenience of description. For example, the size and thickness of each component shown in the drawings are arbitrarily indicated for convenience of description, and the present invention is not necessarily limited to the illustrated bar.
어떤 실시예가 달리 구현 가능한 경우에 특정한 프로세스의 순서는 설명되는 순서와 다르게 수행될 수도 있다. 예를 들어, 연속하여 설명되는 두 프로세스가 실질적으로 동시에 수행될 수도 있고, 설명되는 순서와 반대의 순서로 진행될 수 있다.In cases where certain embodiments are otherwise implementable, the order of specific processes may be performed differently from the order in which they are described. For example, two processes described in succession may be performed substantially simultaneously, or may be performed in an order opposite to the order described.
이하의 실시예에서, 구성 요소 등이 연결되었다고 할 때, 구성 요소들이 직접적으로 연결된 경우뿐만 아니라 구성요소들 중간에 구성 요소들이 개재되어 간접적으로 연결된 경우도 포함한다.In the following embodiments, when components are connected, it includes not only cases in which components are directly connected, but also cases in which components are interposed between components and connected indirectly.
예컨대, 본 명세서에서 구성 요소 등이 전기적으로 연결되었다고 할 때, 구성 요소 등이 직접 전기적으로 연결된 경우뿐만 아니라, 그 중간에 구성 요소 등이 개재되어 간접적으로 전기적 연결된 경우도 포함한다.For example, in the present specification, when it is said that components and the like are electrically connected, it includes not only the case where the components are directly electrically connected, but also the case where the components are interposed therebetween to be indirectly electrically connected.
본 출원의 일 실시예에 따른 신경망 모델 최적화 방법은, 학습이 완료된 신경망 모델의 실행 데이터를 획득하는 단계-상기 실행 데이터는 상기 신경망 모델의 계층 데이터, 상기 신경망 모델을 구성하는 연산 데이터(operation data), 및 상기 신경망 모델의 파라미터 중 적어도 하나를 포함함-; 상기 신경망 모델의 실행 데이터에 기초하여 상기 신경망 모델의 구조에 대한 최적화를 수행하고 인스트럭션 정보를 획득하는 단계; 상기 인스트럭션 정보에 기초하여 상기 신경망 모델이 구동될 임베디드 장치에 대한 최적화를 수행하고 최적 코드 정보를 획득하는 단계; 및 상기 최적 코드 정보를 송신하는 단계;를 포함하되, 상기 신경망 모델의 구조에 대한 최적화를 수행하고 인스트럭션 정보를 획득하는 단계는, 상기 실행 데이터에 기초하여 방향성 비사이클 그래프(DAG)를 생성하는 단계; 상기 방향성 비사이클 그래프에 기초하여 연산들의 실행 순서를 결정하는 단계; 미리 정해진 기준 연산 패턴에 기초하여 상기 기준 연산 패턴에 대응되는 상기 방향성 비사이클 그래프의 대상 연산 패턴을 검출하고, 상기 대상 연산 패턴에 포함된 제1 대상 연산과 제2 대상 연산을 병합하는 단계; 상기 결정된 실행 순서에 기초하여 제1 메모리 공간 맵을 획득하고, 상기 제1 메모리 공간 맵에 기초하여 메모리 할당과 관련된 최적화를 수행하는 단계; 및 최적화 수행 결과에 기초하여 메모리 주소와 관련된 인스트럭션을 생성하는 단계;를 더 포함할 수 있다. The method for optimizing a neural network model according to an embodiment of the present application includes: acquiring execution data of a neural network model on which learning is completed - The execution data is hierarchical data of the neural network model, operation data constituting the neural network model , and at least one of the parameters of the neural network model; performing optimization on the structure of the neural network model based on the execution data of the neural network model and obtaining instruction information; performing optimization on an embedded device in which the neural network model is to be driven based on the instruction information and obtaining optimal code information; and transmitting the optimal code information; wherein, performing optimization on the structure of the neural network model and obtaining instruction information includes: generating a directional acyclic graph (DAG) based on the execution data ; determining an execution order of operations based on the directed acyclic graph; detecting a target operation pattern of the directional acyclic graph corresponding to the reference operation pattern based on a predetermined reference operation pattern, and merging the first target operation and the second target operation included in the target operation pattern; obtaining a first memory space map based on the determined execution order, and performing optimization related to memory allocation based on the first memory space map; and generating an instruction related to a memory address based on the optimization result.
본 출원의 일 실시예에 따르면, 상기 제1 대상 연산과 상기 제2 대상 연산을 병합하는 단계는, 미리 정해진 기준 연산 패턴 정보를 획득하는 단계-상기 기준 연산 패턴 정보는 제1 연산 및 상기 제1 연산과 연계된 제2 연산을 포함함-; 상기 기준 연산 패턴 정보에 기초하여 상기 방향성 비사이클 그래프로부터 상기 제1 연산에 대응되는 상기 제1 대상 연산 및 상기 제2 연산에 대응되는 상기 제2 대상 연산을 검출하는 단계; 및 상기 제1 대상 연산과 상기 제2 대상 연산을 병합하고, 상기 병합 결과에 기초하여 커널을 변환하는 단계;를 더 포함할 수 있다. According to an embodiment of the present application, the step of merging the first target operation and the second target operation includes: obtaining predetermined reference operation pattern information - The reference operation pattern information includes the first operation and the first operation comprising a second operation associated with the operation; detecting the first target operation corresponding to the first operation and the second target operation corresponding to the second operation from the directional acyclic graph based on the reference operation pattern information; and merging the first target operation and the second target operation, and transforming a kernel based on a result of the merging.
본 출원의 일 실시예에 따르면, 상기 메모리 할당과 관련된 최적화를 수행하는 단계는, 상기 결정된 실행 순서 및 상기 연산을 통하여 출력되는 데이터의 크기에 기초하여 상기 제1 메모리 공간 맵을 생성하는 단계; 제3 대상 연산으로 입력된 값이 저장되는 제1 메모리 텐서를 상기 제3 대상 연산을 통하여 출력된 값이 저장되는 제2 메모리 텐서로 변경하는 단계; 및 상기 변경 결과에 기초하여 상기 제1 메모리 공간 맵으로부터 제2 메모리 공간 맵을 생성하는 단계;를 더 포함할 수 있다. According to an embodiment of the present application, the performing of the optimization related to the memory allocation may include: generating the first memory space map based on the determined execution order and the size of data output through the operation; changing a first memory tensor in which a value input through a third target operation is stored into a second memory tensor in which a value output through the third target operation is stored; and generating a second memory space map from the first memory space map based on the change result.
본 출원의 일 실시예에 따르면, 상기 연산들의 실행 순서를 결정하는 단계는, 상기 방향성 비사이클 그래프의 제1 브랜치(branch)에 포함된 제4 대상 연산에 요구되는 제1 메모리 공간과 상기 방향성 비사이클 그래프의 제2 브랜치에 포함된 제5 대상 연산에 요구되는 제2 메모리 공간을 연산하는 단계; 상기 제1 메모리 공간과 상기 제2 메모리 공간을 비교하는 단계; 및 상기 비교 결과에 따라 상기 제4 대상 연산과 상기 제5 대상 연산의 실행 순서를 결정하는 단계;를 더 포함할 수 있다. According to an embodiment of the present application, the determining of the execution order of the operations includes a first memory space required for a fourth target operation included in a first branch of the directed acyclic graph and the directionality ratio calculating a second memory space required for a fifth target operation included in a second branch of the cycle graph; comparing the first memory space and the second memory space; and determining the execution order of the fourth target operation and the fifth target operation according to the comparison result.
본 출원의 일 실시예에 따르면, 상기 제1 메모리 공간이 상기 제2 메모리 공간보다 큰 경우, 상기 제4 대상 연산의 실행 순서는 상기 제5 대상 연산의 실행 순서보다 후순위로 할당하되, 상기 제1 메모리 공간이 상기 제2 메모리 공간보다 작은 경우, 상기 제4 대상 연산의 실행 순서는 상기 제5 대상 연산의 실행 순서보다 선순위로 할당할 수 있다. According to an embodiment of the present application, when the first memory space is larger than the second memory space, the execution order of the fourth target operation is allocated with a lower priority than the execution order of the fifth target operation, and the first memory space is larger than the second memory space. When the memory space is smaller than the second memory space, the execution order of the fourth target operation may be allocated with a higher priority than the execution order of the fifth target operation.
본 출원의 일 실시예에 따르면, 상기 신경망 모델의 구조에 대한 최적화를 수행하고 인스트럭션 정보를 획득하는 단계는, 상기 신경망 모델의 연산(operation)과 관련된 입력 데이터 및 출력 데이터를 획득하는 단계; 및 상기 입력 데이터 및 상기 출력 데이터를 미리 결정된 정수 범위에 해당하는 값으로 조정하는 단계;를 더 포함할 수 있다. According to an embodiment of the present application, the step of optimizing the structure of the neural network model and obtaining instruction information may include: obtaining input data and output data related to an operation of the neural network model; and adjusting the input data and the output data to values corresponding to a predetermined integer range.
본 출원의 일 실시예에 따르면, 상기 신경망 모델 최적화 방법을 실행시키기 위한 프로그램을 기록한 컴퓨터로 읽을 수 있는 기록매체가 제공될 수 있다.According to an embodiment of the present application, a computer-readable recording medium in which a program for executing the neural network model optimization method is recorded may be provided.
본 출원의 일 실시예에 따른 신경망 모델 최적화 장치는, 학습이 완료된 신경망 모델의 실행 데이터 및 신경망 모델이 구동될 임베디드 장치의 컴퓨팅 환경 정보를 획득하는 송수신부; 및 상기 실행 데이터 및 상기 임베디드 장치의 컴퓨팅 환경 정보에 기초하여 상기 신경망 모델에 대한 최적화를 수행하는 프로세서;를 포함하되, 상기 프로세서는, 학습이 완료된 신경망 모델의 실행 데이터-상기 실행 데이터는 상기 신경망 모델의 계층 데이터, 상기 신경망 모델을 구성하는 연산 데이터(operation data), 및 상기 신경망 모델의 파라미터 중 적어도 하나를 포함함-를 획득하고, 상기 신경망 모델의 실행 데이터에 기초하여 상기 신경망 모델의 구조에 대한 최적화를 수행하고 인스트럭션 정보를 획득하고, 상기 인스트럭션 정보에 기초하여 상기 신경망 모델이 구동될 임베디드 장치에 대한 최적화를 수행하고 최적 코드 정보를 획득하고, 상기 최적 코드 정보를 송신하도록 구성되되, 상기 프로세서는, 상기 실행 데이터에 기초하여 방향성 비사이클 그래프(DAG)를 생성하고, 상기 방향성 비사이클 그래프에 기초하여 연산들의 실행 순서를 결정하고, 미리 정해진 기준 연산 패턴에 기초하여 상기 기준 연산 패턴에 대응되는 상기 방향성 비사이클 그래프의 대상 연산 패턴을 검출하고, 상기 대상 연산 패턴에 포함된 제1 대상 연산과 제2 대상 연산을 병합하고, 상기 결정된 실행 순서에 기초하여 제1 메모리 공간 맵을 획득하고, 상기 제1 메모리 공간 맵에 기초하여 메모리 할당과 관련된 최적화를 수행하고, 최적화 수행 결과에 기초하여 메모리 주소와 관련된 인스트럭션을 생성함으로써, 상기 인스트럭션 정보를 획득하도록 구성될 수 있다. An apparatus for optimizing a neural network model according to an embodiment of the present application includes: a transceiver for acquiring execution data of a neural network model that has been trained and computing environment information of an embedded device in which the neural network model is to be driven; and a processor for performing optimization on the neural network model based on the execution data and computing environment information of the embedded device, wherein the processor includes: execution data of a neural network model that has been trained - the execution data is the neural network model obtain hierarchical data of , operation data constituting the neural network model, and at least one of parameters of the neural network model; and, based on the execution data of the neural network model, configured to perform optimization and obtain instruction information, perform optimization on an embedded device in which the neural network model is to be driven based on the instruction information, obtain optimal code information, and transmit the optimal code information, wherein the processor comprises: , generates a directional acyclic graph (DAG) based on the execution data, determines an execution order of operations based on the directional acyclic graph, and corresponds to the reference operation pattern based on a predetermined reference operation pattern Detect a target operation pattern of a directed acyclic graph, merge a first target operation and a second target operation included in the target operation pattern, obtain a first memory space map based on the determined execution order, and 1 may be configured to obtain the instruction information by performing optimization related to memory allocation based on the memory space map and generating an instruction related to a memory address based on a result of performing the optimization.
본 출원의 일 실시예에 따른 신경망 모델 최적화 방법은, 학습이 완료된 신경망 모델의 실행 데이터를 획득하는 단계-상기 실행 데이터는 상기 신경망 모델의 계층 데이터, 상기 신경망 모델을 구성하는 연산 데이터(operation data) 및 상기 신경망 모델의 파라미터 중 적어도 하나를 포함함-; 상기 신경망 모델의 실행 데이터에 기초하여 상기 신경망 모델의 구조에 대한 최적화를 수행하고 인스트럭션 정보를 획득하는 단계-상기 인스트럭션 정보는 연산의 유형, 연산의 및 메모리 주소 중 적어도 하나와 관련된 정보를 포함함-; 상기 인스트럭션 정보에 기초하여 상기 신경망 모델이 구동될 임베디드 장치에 대한 최적화를 수행하고 최적 코드 정보를 획득하는 단계; 및 상기 최적 코드 정보를 송신하는 단계;를 포함하되, 상기 최적 코드 정보를 획득하는 단계는, 상기 임베디드 장치의 컴퓨팅 환경 정보를 획득하는 단계; 강화 학습으로 훈련된 에이전트를 통하여, 인스트럭션 정보로부터 최적화 파라미터를 획득하는 단계; 및 상기 최적화 파라미터에 기초하여 상기 임베디드 장치에서 이용될 코드 정보를 생성하는 단계;를 더 포함할 수 있다. The method for optimizing a neural network model according to an embodiment of the present application includes: acquiring execution data of a neural network model on which learning is completed - The execution data is hierarchical data of the neural network model, operation data constituting the neural network model and at least one of the parameters of the neural network model; performing optimization on the structure of the neural network model and obtaining instruction information based on the execution data of the neural network model, wherein the instruction information includes information related to at least one of a type of operation, a description of the operation, and a memory address- ; performing optimization on an embedded device in which the neural network model is to be driven based on the instruction information and obtaining optimal code information; and transmitting the optimal code information; wherein the acquiring of the optimal code information includes: acquiring computing environment information of the embedded device; obtaining optimization parameters from instruction information through an agent trained by reinforcement learning; and generating code information to be used in the embedded device based on the optimization parameter.
본 출원의 일 실시예에 따르면, 상기 최적화 파라미터를 획득하는 단계는, 상기 연산에 대응되는 적어도 하나 이상의 연산 유형 정보, 메모리 상태 정보, 및 상기 임베디드 장치의 컴퓨팅 환경 정보 중 적어도 하나를 상기 에이전트에 입력하는 단계; 및 상기 에이전트를 통하여 출력되는 최적화 파라미터를 획득하는 단계;를 더 포함할 수 있다.According to an embodiment of the present application, the obtaining of the optimization parameter may include inputting at least one of at least one operation type information corresponding to the operation, memory state information, and computing environment information of the embedded device to the agent. to do; and obtaining an optimization parameter output through the agent.
본 출원의 일 실시예에 따르면, 상기 최적화 파라미터는, 상기 연산에 대하여 수행될 알고리즘 유형을 선택하는 파라미터, 상기 연산의 블록 사이즈와 관련된 파라미터, 및 코드의 길이와 관련된 파라미터 중 적어도 하나와 관련될 수 있다.According to an embodiment of the present application, the optimization parameter may be related to at least one of a parameter for selecting an algorithm type to be performed with respect to the operation, a parameter related to a block size of the operation, and a parameter related to a length of a code. have.
본 출원의 일 실시예에 따르면, 상기 에이전트는, 초기 규칙에 따라, 타겟 임베디드 장치의 컴퓨팅 환경과 관련된 타겟 장치 정보, 메모리 상태 정보, 및 연산(operation)에 대응되는 적어도 하나 이상의 알고리즘 유형 정보에 기초하여 파라미터와 관련된 예측값을 출력하도록 구성되되, 상기 에이전트는, 예측값을 통하여 생성된 코드의 성능에 대한 평가값이 최대화되도록 상기 초기 규칙이 갱신됨으로써 훈련될 수 있다. According to an embodiment of the present application, the agent is, according to an initial rule, based on target device information related to the computing environment of the target embedded device, memory state information, and at least one or more algorithm type information corresponding to an operation to output a prediction value related to the parameter, the agent can be trained by updating the initial rule so that the evaluation value for the performance of the code generated through the prediction value is maximized.
본 출원의 일 실시예에 따르면, 상기 임베디드 장치에서 이용될 코드 정보를 생성하는 단계는, 상기 최적화 파라미터에 기초하여 상기 인스트럭션 정보에 대응되도록 코드를 생성하는 단계; 및 상기 생성된 코드를 컴파일하여 바이너리 파일 형태로 변환하는 단계;를 더 포함할 수 있다. According to an embodiment of the present application, the generating of the code information to be used in the embedded device may include: generating a code to correspond to the instruction information based on the optimization parameter; and compiling the generated code and converting it into a binary file format.
본 출원의 일 실시예에 따르면, 상기 신경망 모델 최적화 방법을 실행시키기 위한 프로그램을 기록한 컴퓨터로 읽을 수 있는 기록매체가 제공될 수 있다.According to an embodiment of the present application, a computer-readable recording medium in which a program for executing the neural network model optimization method is recorded may be provided.
본 출원의 일 실시예에 따른 신경망 모델 최적화 장치는, 학습이 완료된 신경망 모델의 실행 데이터 및 신경망 모델이 구동될 임베디드 장치의 컴퓨팅 환경 정보를 획득하는 송수신부; 및 상기 실행 데이터 및 상기 임베디드 장치의 컴퓨팅 환경 정보에 기초하여 상기 신경망 모델에 대한 최적화를 수행하는 프로세서;를 포함하되, 상기 프로세서는, 학습이 완료된 신경망 모델의 실행 데이터-상기 실행 데이터는 상기 신경망 모델의 계층 데이터, 상기 신경망 모델을 구성하는 연산 데이터(operation data), 및 상기 신경망 모델의 파라미터 중 적어도 하나를 포함함-를 획득하고, 상기 신경망 모델의 실행 데이터에 기초하여 상기 신경망 모델의 구조에 대한 최적화를 수행하고 인스트럭션 정보-상기 인스트럭션 정보는 연산의 유형, 및 메모리 주소 중 적어도 하나와 관련된 정보를 포함함-를 획득하고, 상기 인스트럭션 정보에 기초하여 상기 신경망 모델이 구동될 임베디드 장치에 대한 최적화를 수행하고 최적 코드 정보를 획득하고, 상기 최적 코드 정보를 송신하도록 구성되되, 상기 프로세서는, 상기 임베디드 장치의 컴퓨팅 환경 정보를 획득하고, 강화 학습으로 훈련된 에이전트를 통하여, 인스트럭션 정보로부터 최적화 파라미터를 획득하고, 상기 최적화 파라미터에 기초하여 상기 임베디드 장치에서 이용될 코드 정보를 생성함으로써 상기 최적 코드 정보를 획득하도록 구성될 수 있다. An apparatus for optimizing a neural network model according to an embodiment of the present application includes: a transceiver for acquiring execution data of a neural network model that has been trained and computing environment information of an embedded device in which the neural network model is to be driven; and a processor for performing optimization on the neural network model based on the execution data and computing environment information of the embedded device, wherein the processor includes: execution data of a neural network model that has been trained - the execution data is the neural network model obtain hierarchical data of , operation data constituting the neural network model, and at least one of parameters of the neural network model; and, based on the execution data of the neural network model, Perform optimization and obtain instruction information, wherein the instruction information includes information related to at least one of a type of operation and a memory address, and optimize an embedded device in which the neural network model is to be driven based on the instruction information. and obtain optimal code information, and send the optimal code information, wherein the processor acquires computing environment information of the embedded device, and through an agent trained in reinforcement learning, obtains optimization parameters from the instruction information and to obtain the optimal code information by generating code information to be used in the embedded device based on the optimization parameter.
이하에서는 도 1 내지 도 9를 참고하여 본 출원의 신경망 모델 최적화 방법, 신경망 모델 최적화 장치, 및 신경망 모델 최적화 시스템에 관하여 설명한다. Hereinafter, a neural network model optimization method, a neural network model optimization apparatus, and a neural network model optimization system of the present application will be described with reference to FIGS. 1 to 9 .
도 1은 본 출원의 일 실시예에 따른 신경망 모델 최적화 시스템의 개략도이다. 1 is a schematic diagram of a neural network model optimization system according to an embodiment of the present application.
본 출원의 일 실시예에 따른 신경망 모델 최적화 시스템(10)은 임베디드 장치(100) 및 신경망 모델 최적화 장치(1000, 혹은 서버)를 포함할 수 있다. The neural network
임베디드 장치(100)는 특정 목적(혹은 특정 기능)을 가지고 만들어진 프로그래밍이 가능한 임의의 임베디드 시스템(Embedded system)이 내재된 장치를 포괄하는 의미일 수 있다. 임베디드 장치(100)는 프로세서 및/또는 메모리를 포함하는 하드웨어를 포함할 수 있다. 또한, 임베디드 장치(100)는 하드웨어를 제어하기 위한 펌웨어(Firmware)를 포함할 수 있다. 또한, 임베디드 장치(100)는 인공지능 실행 엔진을 포함하여 임의의 소프트웨어를 펌웨어에 입력하여 임의의 인공지능 모델을 실행하도록 구성될 수 있다. 여기서, 인공지능 실행 엔진(Inference Engine)은 미리 학습된 신경망 모델을 임베디드 장치(100)에 최대한 효율적으로 실행시키기 위한 소프트웨어로서, 인공지능 실사용에 목적을 둔 기술이며 탑재되는 장치의 환경에 효율성을 높이는 기능을 수행한다. 예컨대, 모바일 기기의 경우, 모바일 기기의 컴퓨팅 환경인 느린 연산속도 및 저전력 사양에 맞춰 실행엔진이 구현될 수 있다. 다른 예로, 컴퓨팅 성능이 상대적으로 높은 PC 서버의 경우에는 고성능 병렬처리 능력을 극대화하도록 실행 엔진이 구현될 수 있다.The embedded
본 출원의 일 실시예에 따른 임베디드 장치(100)는 신경망 모델 최적화 장치(1000)로부터 임베디드 장치(100)의 컴퓨팅 환경에 최적화된 최적 코드 정보를 획득하고, 최적 코드 정보를 펌웨어에 추가(혹은 입력)할 수 있다. 후술할 바와 같이, 최적 코드 정보는 신경망 모델의 내부 구조를 분석하여 생성될 수 있다. 또한, 최적 코드 정보는 임베디드 장치(100)의 메모리 사양 및/또는 프로세서 사양 등을 포함한 컴퓨팅 환경을 고려하여 생성될 수 있다. 또한, 임베디드 장치(100)는 신경망 모델 최적화 장치(1000)로부터 생성된 최적 코드 정보를 펌웨어에 추가하고, 신경망 모델의 실행을 수행할 수 있다. The embedded
본 출원의 일 실시예에 따른 신경망 모델 최적화 장치(1000)는 임베디드 장치(100) 이외의 임의의 장치(혹은 서버)에서 훈련된 신경망 모델이 임베디드 장치(100)의 컴퓨팅 환경에서 최적으로 실행될 수 있도록, 신경망 모델의 연산 구조 및/또는 메모리 할당에 대한 최적화를 수행할 수 있다. 또한, 본 출원의 일 실시예에 따른 신경망 모델 최적화 장치(1000)는 신경망 모델이 임베디드 장치(100)의 컴퓨팅 환경에서 최적으로 실행될 수 있는 최적 코드를 자동적으로 생성할 수 있다. The
본 출원의 일 실시예에 따른 신경망 모델 최적화 장치(1000)는 송수신부(1100), 메모리(1200), 및 프로세서(1300)를 포함할 수 있다.The
신경망 모델 최적화 장치(1000)의 송수신부(1100)는 임베디드 장치(100)를 포함하여 임의의 외부 기기와 통신을 수행할 수 있다. 예컨대, 신경망 모델 최적화 장치(1000)는, 송수신부(1100)를 통해, 최적화를 수행함으로써 획득한 최적 코드 정보를 임베디드 장치(100)로 송신할 수 있다. 또한, 신경망 모델 최적화 장치(1000)는, 송수신부(1100)를 통해, 임베디드 장치(100) 혹은 임의의 외부 장치로부터 임베디드 장치(100)의 컴퓨팅 환경 정보를 수신할 수 있다. 또한 신경망 모델 최적화 장치(1000)는, 송수신부(1100)를 통해, 학습이 완료된 신경망 모델 및/또는 신경망 모델을 실행시키기 위한 실행데이터를 수신할 수 있다. The
신경망 모델 최적화 장치(1000)는, 송수신부(1100)를 통해, 네트워크에 접속하여 각종 데이터를 송수신할 수 있다. 송수신부는 크게 유선 타입과 무선 타입을 포함할 수 있다. 유선 타입과 무선 타입은 각각의 장단점을 가지므로, 경우에 따라서 신경망 모델 최적화 장치(1000)에는 유선 타입과 무선 타입이 동시에 마련될 수도 있다. 여기서, 무선 타입의 경우에는 주로 와이파이(Wi-Fi) 같은 WLAN(Wireless Local Area Network) 계열의 통신 방식을 이용할 수 있다. 또는, 무선 타입의 경우에는 셀룰러 통신, 예컨대, LTE, 5G 계열의 통신 방식을 이용할 수 있다. 다만, 무선 통신 프로토콜이 상술한 예시에 제한되는 것은 아니며, 임의의 적절한 무선 타입의 통신 방식을 이용하는 것도 가능하다. 유선 타입의 경우에는 LAN(Local Area Network)이나 USB(Universal Serial Bus) 통신이 대표적인 예이며 그 외의 다른 방식도 가능하다.The
신경망 모델 최적화 장치(1000)의 메모리(1200)는 각종 정보를 저장할 수 있다. 메모리(1200)에는 각종 데이터가 임시적으로 또는 반영구적으로 저장될 수 있다. 메모리의 예로는 하드 디스크(HDD: Hard Disk Drive), SSD(Solid State Drive), 플래쉬 메모리(flash memory), 롬(ROM: Read-Only Memory), 램(RAM: Random Access Memory) 등이 있을 수 있다. 메모리(1200)는 신경망 모델 최적화 장치(1000)에 내장되는 형태나 탈부착 가능한 형태로 제공될 수 있다. 메모리(1200)에는 신경망 모델 최적화 장치(1000)를 구동하기 위한 운용 프로그램(OS: Operating System)이나 신경망 모델 최적화 장치(1000)의 각 구성을 동작시키기 위한 프로그램을 비롯해 신경망 모델 최적화 장치(1000)의 동작에 필요한 각종 데이터가 저장될 수 있다.The
프로세서(1300)는 신경망 모델 최적화 장치(1000)의 전반적인 동작을 제어할 수 있다. 예컨대, 프로세서(1300)는 후술할 학습이 완료된 신경망 모델의 실행 데이터를 획득하는 동작, 신경망 모델의 구조에 대한 최적화를 수행하는 동작, 임베디드 장치에 대한 최적화를 수행하는 동작, 최적화 결과에 따라 생성된 최적 코드 정보를 획득하는 동작, 및/또는 최적 코드 정보를 송신하는 동작 등 신경망 모델 최적화 장치(1000)의 전반적인 동작을 제어할 수 있다. 구체적으로 프로세서(1300)는 메모리(1200)로부터 신경망 모델 최적화 장치(1000)의 전반적인 동작을 위한 프로그램을 로딩하여 실행할 수 있다. 프로세서(1300)는 하드웨어나 소프트웨어 또는 이들의 조합에 따라 AP(Application Processor), CPU(Central Processing Unit), MCU(Microcontroller Unit)나 이와 유사한 장치로 구현될 수 있다. 이때, 하드웨어적으로는 전기적 신호를 처리하여 제어 기능을 수행하는 전자 회로 형태로 제공될 수 있으며, 소프트웨어적으로는 하드웨어적 회로를 구동시키는 프로그램이나 코드 형태로 제공될 수 있다.The
이하에서는 도 2 내지 도 9를 참고하여, 본 출원의 일 실시예에 따른 신경망 모델 최적화 장치(1000)의 동작 및 신경망 모델 최적화 방법을 구체적으로 서술한다. Hereinafter, an operation of the
도 2는 본 출원의 일 실시예에 따른 신경망 모델 최적화 방법을 나타낸 순서도이다.2 is a flowchart illustrating a method for optimizing a neural network model according to an embodiment of the present application.
본 출원의 일 실시예에 따른 신경망 모델 최적화 방법은, 학습이 완료된 신경망 모델의 실행 데이터를 획득하는 단계(S1000), 신경망 모델의 구조에 대한 최적화를 수행하고 인스트럭션 정보를 획득하는 단계(S2000), 임베디드 장치에 대한 최적화를 수행하고 최적 코드 정보를 획득하는 단계(S3000), 및 최적 코드 정보를 송신하는 단계(S4000)를 더 포함할 수 있다.A method for optimizing a neural network model according to an embodiment of the present application includes: acquiring execution data of a neural network model on which learning is completed (S1000), performing optimization on the structure of the neural network model and acquiring instruction information (S2000), The method may further include performing optimization for the embedded device and obtaining optimal code information (S3000), and transmitting optimal code information (S4000).
학습이 완료된 신경망 모델의 실행 데이터를 획득하는 단계(S1000)에서는, 신경망 모델 최적화 장치(1000)는, 송수신부(1100)를 통하여 학습이 완료된 신경망 모델의 실행 데이터를 획득할 수 있다. 여기서, 실행 데이터란, 신경망 모델의 계층 데이터, 신경망 모델을 구성하는 연산 데이터(operation data), 및/또는 신경망 모델과 관련된 임의의 가중치(혹은 파라미터)를 포함하여, 신경망 모델을 실행시키기 위하여 필요한 임의의 적절한 데이터를 포괄하는 의미일 수 있다. In step S1000 of obtaining the execution data of the neural network model on which the learning has been completed, the
신경망 모델의 구조에 대한 최적화를 수행하고 인스트럭션 정보를 획득하는 단계(S2000)에서는, 신경망 모델 최적화 장치(1000)는 신경망 모델의 실행데이터에 기초하여 신경망 모델의 구조에 대한 최적화, 예컨대 신경망 모델의 구조에 대한 경량화를 수행할 수 있다. 일 예로, 신경망 모델 최적화 장치(1000)는 신경망 모델의 연산 구조에 포함된 연산 패턴을 검출하고, 연산 패턴에 포함된 대상 연산들을 병합하는 동작을 수행하도록 구성될 수 있다. 다른 예로, 신경망 모델 최적화 장치(1000)는 신경망 모델의 연산들의 실행 순서를 결정하고, 결정된 실행 순서에 기초하여 메모리 할당과 관련된 최적화를 수행할 수 있다. In the step of optimizing the structure of the neural network model and obtaining instruction information ( S2000 ), the
신경망 모델의 구조에 대한 최적화를 수행하고 인스트럭션 정보를 획득하는 단계(S2000)에서는, 신경망 모델 최적화 장치(1000)는 최적화 수행 결과에 따라 인스트럭션 정보를 획득할 수 있다. 여기서, 인스트럭션 정보는, 신경망 모델의 연산들의 유형에 대한 인스트럭션, 및/또는 신경망 모델의 각 연산과 관련된 메모리 주소에 대한 인스트럭션을 포함할 수 있다. S2000 단계에 대하여는 도 3 내지 도 7에서 보다 구체적으로 서술하기로 한다. In the step of optimizing the structure of the neural network model and obtaining instruction information ( S2000 ), the
임베디드 장치에 대한 최적화를 수행하고 최적 코드 정보를 획득하는 단계(S3000)에서는, 신경망 모델 최적화 장치(1000)는, 훈련이 완료된 신경망 모델을 임베디드 장치(100)의 컴퓨팅 환경에 최적으로 실행시키기 위한 코드를 생성할 수 있다. 구체적으로 신경망 모델 최적화 장치(1000)는 강화 학습 기법으로 훈련된 에이전트를 통하여, S2000 단계에서 획득한 인스트럭션 정보 및 임베디드 장치 정보에 기초하여 최적화 파라미터를 획득하고, 최적화 파라미터에 기초하여 임베디드 장치(100)에서 이용될 최적 코드 정보를 생성하도록 구현될 수 있다. S3000 단계에 대하여는 도 8 내지 도 9에서 보다 구체적으로 서술하기로 한다.In the step of performing optimization for the embedded device and obtaining optimal code information ( S3000 ), the neural network
최적 코드 정보를 송신하는 단계(S4000)에서는, 신경망 모델 최적화 장치(1000)는, 송수신부(1100)를 통하여, 획득된 최적 코드 정보를 임베디드 장치(100)를 포함하여 임의의 외부 장치(혹은 외부 서버)로 송신하도록 구현될 수 있다. In the step of transmitting the optimal code information (S4000), the neural network
이하에서는 도 3 내지 7을 참고하여 본 출원의 일 실시예에 따른 신경망 모델의 구조에 대한 최적화에 관한 내용을 보다 구체적으로 서술하도록 한다. Hereinafter, with reference to FIGS. 3 to 7 , content related to optimization of the structure of a neural network model according to an embodiment of the present application will be described in more detail.
도 3은 본 출원의 일 실시예에 따른 신경망 모델의 구조에 대한 최적화를 수행하고 인스트럭션 정보를 획득하는 단계를 구체화한 순서도이다. 3 is a flowchart detailing the steps of performing optimization on the structure of a neural network model and acquiring instruction information according to an embodiment of the present application.
본 출원의 일 실시예에 따른 신경망 모델의 구조에 대한 최적화를 수행하고 인스트럭션 정보를 획득하는 단계(S2000)는, 실행 데이터에 기초하여 방향성 비사이클 그래프(Directed Acyclic Graph, DAG)를 생성하는 단계(S2100), DAG에 기초하여 연산들의 실행 순서를 결정하는 단계(S2200), 미리 정해진 기준 연산 패턴에 대응되는 DAG의 대상 연산 패턴을 검출하고, 대상 연산 패턴에 포함된 제1 대상 연산과 제2 대상 연산을 병합하는 단계(S2300), 결정된 실행 순서에 기초하여 제1 메모리 공간 맵을 획득하고, 제1 메모리 공간 맵에 기초하여 메모리 할당과 관련된 최적화를 수행하는 단계(S2400), 및 최적화 수행 결과에 기초하여 메모리 주소와 관련된 인스트럭션을 생성하는 단계(S2500)를 더 포함할 수 있다. The step of performing optimization of the structure of the neural network model according to an embodiment of the present application and obtaining instruction information (S2000) is a step of generating a Directed Acyclic Graph (DAG) based on the execution data ( S2100), determining the execution order of operations based on the DAG (S2200), detecting a target operation pattern of the DAG corresponding to a predetermined reference operation pattern, and a first target operation and a second target included in the target operation pattern merging operations (S2300), obtaining a first memory space map based on the determined execution order, performing optimization related to memory allocation based on the first memory space map (S2400), and performing optimization on the results The method may further include generating an instruction related to the memory address based on the step (S2500).
실행 데이터에 기초하여 방향성 비사이클 그래프(Directed Acyclic Graph, 이하 DAG)를 생성하는 단계(S2100)에서는, 신경망 모델 최적화 장치(1000)는 신경망 모델의 실행 데이터(예컨대, 신경망 모델의 계층 데이터, 신경망 모델을 구성하는 연산 데이터(operation data), 및/또는 신경망 모델의 파라미터 등)에 기초하여 DAG를 생성할 수 있다. DAG는 방향 순환이 없는 임의의 무한 유향 그래프를 지칭하는 의미일 수 있다. In the step S2100 of generating a directed acyclic graph (hereinafter referred to as DAG) based on the execution data, the neural network
도 4는 본 출원의 일 실시예에 따른 DAG의 일 양상을 도시한 도면이다. 4 is a diagram illustrating an aspect of a DAG according to an embodiment of the present application.
DAG는 신경망 모델을 구성하는 각 함수들의 데이터 의존 관계, 예컨대, 각 함수들의 연결관계와 관련된 정보를 포함할 수 있다. 예컨대, DAG는 제1 연산(예컨대, A)과 연결된 제2 연산(예컨대, B) 및 제2 연산과 연결된 제3 연산(예컨대, C)을 포함하는 제1 브랜치 구조와 관련된 연결관계와 관련된 정보를 포함할 수 있다. 예컨대, DAG는 제1 연산(예컨대, A)과 연결된 제4 연산(예컨대, D) 및 제4 연산과 연결된 제5 연산(예컨대, E)을 포함하는 제2 브랜치 구조와 관련된 연결관계와 관련된 정보를 포함할 수 있다. 또한, DAG는 제3 연산과 제5 연산과 연결된 제6 연산(예컨대, F)과 관련된 연결관계와 관련된 정보를 포함할 수 있다. 다만, 도 4는 DAG의 설명의 편의를 위한 예시에 불과하며, 이에 제한적으로 해석되지 않는다. The DAG may include information related to a data dependency relationship of each function constituting the neural network model, for example, a connection relationship between each function. For example, the DAG includes information related to a connection relationship associated with a first branch structure including a second operation (eg, B) associated with a first operation (eg, A) and a third operation (eg, C) associated with the second operation. may include. For example, the DAG includes information related to a connection relationship associated with a second branch structure including a fourth operation (eg, D) associated with a first operation (eg, A) and a fifth operation (eg, E) associated with the fourth operation may include. In addition, the DAG may include information related to a connection relationship related to the third operation and the sixth operation (eg, F) connected to the fifth operation. However, FIG. 4 is only an example for convenience of description of the DAG, and is not limited thereto.
DAG에 기초하여 연산들의 실행 순서를 결정하는 단계(S2200)에서는, 신경망 모델 최적화 장치(1000)는 DAG를 이용하여 신경망 모델을 구성하는 적어도 하나 이상의 연산들의 실행 순서를 결정할 수 있다. In determining the execution order of operations based on the DAG ( S2200 ), the
실행 순서를 결정하는 데는 임의의 적절한 규칙이 이용될 수 있다. Any suitable rule may be used to determine the execution order.
일 예로, 신경망 모델 최적화 장치(1000)는 신경망 모델을 구성하는 연산에 요구되는 메모리 공간에 기초하여 DAG의 연산들의 실행 순서를 결정할 수 있다. 예컨대, 신경망 모델 최적화 장치(1000)는 DAG의 제1 브랜치에 포함된 연산(예컨대, 도 4의 B)에 요구되는 제1 메모리 공간과 DAG의 제2 브랜치에 포함된 연산(예컨대, 도 4의 D)에 요구되는 제2 메모리 공간을 연산하고, 제1 메모리 공간과 제2 메모리 공간을 비교하고, 비교 결과에 기초하여 제1 브랜치에 포함된 연산(예컨대, 도 4의 B)과 제2 브랜치에 포함된 연산(예컨대, 도 4의 D) 간의 실행 순서를 결정할 수 있다. 구체적으로 제1 메모리 공간이 제2 메모리 공간보다 큰 경우, 신경망 모델 최적화 장치(1000)는 제1 브랜치에 포함된 연산(예컨대, 도 4의 B)의 실행 순서를 제2 브랜치에 포함된 연산(예컨대, 도 4의 D)의 실행 순서보다 후순위로 할당할 수 있다. 반면 제1 메모리 공간이 제2 메모리 공간보다 작은 경우, 신경망 모델 최적화 장치(1000)는 제1 브랜치에 포함된 연산(예컨대, 도 4의 B)의 실행 순서를 제2 브랜치에 포함된 연산(예컨대, 도 4의 D)의 실행 순서보다 선순위로 할당할 수 있다.As an example, the
다른 예로, 신경망 모델 최적화 장치(1000)는 DAG의 브랜치 구조를 고려하여 신경망 모델을 구성하는 연산들의 실행 순서를 결정할 수 있다. 예컨대, 같은 브랜치에 포함된 연산들을 순차적으로 실행하는 것이, 제1 브랜치에 포함된 연산을 실행하고 제2 브랜치에 포함된 연산을 실행하는 것보다는 메모리 공간 측면에 유리할 수 있다. 따라서, 신경망 모델 최적화 장치(1000)는 제1 브랜치에 포함된 연산들(예컨대, 도 4의 B, C)을 순차적으로 실행한 이후에, 제2 브랜치에 포함된 연산들(예컨대, 도 4의 D, E)를 실행하도록 실행 순서를 결정할 수 있다. 혹은 신경망 모델 최적화 장치(1000)는 제2 브랜치에 포함된 연산들(예컨대, 도 4의 D, E)을 실행하고, 제1 브랜치에 포함된 연산들(예컨대, 도 4의 B, C)를 실행하도록 실행 순서를 결정할 수 있다. As another example, the
미리 정해진 기준 연산 패턴에 대응되는 DAG의 대상 연산 패턴을 검출하고, 대상 연산 패턴에 포함된 제1 대상 연산과 제2 대상 연산을 병합하는 단계(S2300)에서는, 신경망 모델 최적화 장치(1000)는, 미리 정해진 기준 연산 패턴을 획득하고, 기준 연산 패턴에 대응되는 DAG의 대상 연산 패턴을 검출할 수 있다. 또한, 미리 정해진 기준 연산 패턴에 대응되는 DAG의 대상 연산 패턴을 검출하고, 대상 연산 패턴에 포함된 제1 대상 연산과 제2 대상 연산을 병합하는 단계(S2300)에서는, 신경망 모델 최적화 장치(1000)는 검출된 대상 연산 패턴에 포함된 연산들을 병합하는 동작을 수행하도록 구현될 수 있다. In the step (S2300) of detecting the target operation pattern of the DAG corresponding to the predetermined reference operation pattern and merging the first target operation and the second target operation included in the target operation pattern, the neural network
보다 구체적으로 본 출원의 일 실시예에 따른 제1 대상 연산과 제2 대상 연산을 병합하는 단계는, 미리 정해진 기준 연산 패턴 정보-기준 연산 패턴 정보는 제1 연산 및 제1 연산과 연계된 제2 연산을 포함함-를 획득하는 단계, 기준 연산 패턴 정보에 기초하여 DAG로부터 제1 연산에 대응되는 제1 대상 연산 및 제2 연산에 대응되는 제2 대상 연산을 검출하는 단계, 및 제1 대상 연산과 제2 대상 연산을 병합하고, 병합 결과에 기초하여 커널을 변환하는 단계를 더 포함할 수 있다. More specifically, the step of merging the first target operation and the second target operation according to an embodiment of the present application includes the predetermined reference operation pattern information-reference operation pattern information, the first operation and the second operation associated with the first operation. obtaining a-comprising operation, detecting a first target operation corresponding to the first operation and a second target operation corresponding to the second operation from the DAG based on the reference operation pattern information, and the first target operation The method may further include merging the second target operation and the second target operation, and transforming the kernel based on the result of the merging.
도 5는 본 출원의 일 실시예에 따른 제1 대상 연산과 제2 대상 연산을 병합하는 일 양상을 도시한 도면이다. 5 is a diagram illustrating an aspect of merging a first target operation and a second target operation according to an embodiment of the present application.
미리 정해진 기준 연산 패턴 정보-기준 연산 패턴 정보는 제1 연산 및 제1 연산과 연계된 제2 연산을 포함함-를 획득하는 단계에서는, 신경망 모델 최적화 장치(1000)는 미리 정해진 기준 연산 패턴 정보를 획득할 수 있다. 이때, 기준 연산 패턴 정보는 일반적으로 많이 이용되는 연산 패턴과 관련된 정보로, 미리 설정될 수 있다. 예컨대, 기준 연산 패턴 정보는 제1 연산(예컨대, 콘볼루션(Convolution)) 및 제1 연산과 연결된 제2 연산(예컨대, Rectified Linear Unit (ReLu))을 포함하는 연산 패턴과 관련될 수 있다. 다만 이는 설명의 편의를 위한 예시에 불과하며, 임의의 적절한 연산 패턴이 미리 설정될 수 있다. 예컨대, 기준 연산 패턴 정보는 컨볼루션(Convolution) 연산을 수행하고, 뎁스와이스 컨볼루션(Depthwise convolution) 연산과 액티베이션(Activation) 연산을 순차적으로 수행하는 연산 패턴과 관련될 수 있다. 다른 예로, 기준 연산 패턴 정보는 이미지의 색상과 관련된 채널별로 필터를 적용하여 채널별로 데이터를 압축하는 뎁스와이스 컨볼루션(Depthwise convolution) 연산을 수행하여 중간 결과값을 획득하고, 중간결과 값에 기초하여 포인트와이스(Pointwise) 연산을 수행하는 연산 패턴을 포함할 수 있다. In the step of obtaining the predetermined reference operation pattern information - the reference operation pattern information includes the first operation and the second operation associated with the first operation - the
기준 연산 패턴 정보에 기초하여 DAG로부터 제1 연산에 대응되는 제1 대상 연산 및 제2 연산에 대응되는 제2 대상 연산을 검출하는 단계에서는, 신경망 모델 최적화 장치(1000)는 기준 연산 패턴 정보를 이용하여 DAG에 포함된 제1 연산(예컨대, Convolution)에 대응되는 제1 대상 연산(예컨대, 도 5의 제1 대상 연산), 및 제2 연산(예컨대, ReLu)에 대응되는 제2 대상 연산(예컨대, 도 5의 제2 대상 연산)을 포함하는 대상 연산 패턴을 검출할 수 있다. 이때, 대상 연산 패턴을 검출하기 위하여 임의의 패턴 매칭 알고리즘이 이용될 수 있다. In the step of detecting the first target operation corresponding to the first operation and the second target operation corresponding to the second operation from the DAG based on the reference operation pattern information, the neural network
제1 대상 연산과 제2 대상 연산을 병합하고, 병합 결과에 기초하여 커널을 변환하는 단계에서는, 신경망 모델 최적화 장치(1000)는 제1 대상 연산(예컨대, 도 5의 Convolution)과 제2 대상 연산(예컨대, 도 5의 ReLu)를 병합하고, 병합 결과에 기초하여 대상 연산 패턴에 포함된 커널들을 단일 커널(예컨대, Convolution + ReLu 커널)로 변환하도록 구현될 수 있다. 본 실시예에 따르면, 제1 대상 연산과 제2 대상 연산을 병합하여 일체로 연산을 수행함으로써, 연산에 요구되는 메모리 공간을 줄이고, 실행 속도를 높일 수 있다는 유리한 효과가 제공될 수 있다. In the step of merging the first target operation and the second target operation and transforming the kernel based on the merging result, the
다시 도 2를 참고하면, 신경망 모델의 구조에 대한 최적화를 수행하고 인스트럭션 정보를 획득하는 단계(S2000)에서는, 신경망 모델 최적화 장치(1000)는 신경망 모델을 구성하는 연산의 입력 데이터 및/또는 출력 데이터에 대한 정수화를 수행할 수 있다. 구체적으로 신경망 모델 최적화 장치(1000)는 양자화 기법을 활용하여 소수 형태의 연산의 입력 데이터 및/또는 출력 데이터를 특정 범위의 정수로 변환할 수 있다. 여기서 양자화(Quantizaiton)는 32 비트 소수점(float) 값을 8비트 정수(int)로 변환하는 기법이다. 신경망 모델 최적화 장치(1000)는 신경망 모델을 구성하는 연산에 대한 데이터 텐서별로 스케일(Scale)와 제로 포인트(ZeroPoint)를 연산하여, 32 비트 소수점 값을 용량이 상대적으로 작은 8비트 정수 값(int8Value)으로 변환할 수 있다. 예컨대, 신경망 모델 최적화 장치(1000)는 하기의 수학식을 통하여 32 비트 소수점 값을 8비트의 정수 값으로 변환하거나 조정하도록 구성될 수 있다. Referring back to FIG. 2 , in the step of optimizing the structure of the neural network model and obtaining instruction information ( S2000 ), the neural network
다만, 전술한 8비트 정수 양자화는 하나의 예시에 불과하며, 신경망 모델 최적화 장치(1000)는 8비트 정수 외에도, 임의의 소수점 값을 0 혹은 8 비트 자연수 값으로 변환하거나 조정하여 신경망 모델의 구조에 대한 최적화를 수행하도록 구현될 수 있다. However, the above-described 8-bit integer quantization is only an example, and the neural network
다시 도 3을 참고하면, 본 출원의 일 실시예에 따른 신경망 모델의 구조에 대한 최적화를 수행하고 인스트럭션 정보를 획득하는 단계(S2000)는, 결정된 실행 순서에 기초하여 제1 메모리 공간 맵을 획득하고, 제1 메모리 공간 맵에 기초하여 메모리 할당과 관련된 최적화를 수행하는 단계(S2400)를 더 포함할 수 있다. Referring back to FIG. 3 , the step of performing optimization on the structure of the neural network model and obtaining instruction information according to an embodiment of the present application (S2000) is to obtain a first memory space map based on the determined execution order and , performing optimization related to memory allocation based on the first memory space map ( S2400 ).
도 6은 본 출원의 일 실시예에 따른 제1 메모리 공간 맵의 일 양상을 도시한 도면이다. 6 is a diagram illustrating an aspect of a first memory space map according to an embodiment of the present application.
결정된 실행 순서에 기초하여 제1 메모리 공간 맵을 획득하고, 제1 메모리 공간 맵에 기초하여 메모리 할당과 관련된 최적화를 수행하는 단계(S2400)에서는, 신경망 모델 최적화 장치(1000)는, S2200 단계에서 결정된 실행 순서 및 각 연산에 요구되는 메모리 공간에 기초하여 제1 메모리 공간 맵을 생성할 수 있다. 구체적으로 도 4와 관련하여 전술한 규칙에 따라 신경망 모델을 구성하는 연산들의 실행 순서(예컨대, 도 6의 A, B, C, D, E, F 순)가 결정될 수 있다. 이때, 신경망 모델 최적화 장치(1000)는 각 연산을 통하여 출력되는 데이터의 크기와 관련된 메모리 공간에 기초하여 제1 메모리 공간 맵을 생성할 수 있다. 예컨대, 신경망 모델 최적화 장치(1000)는 연산 A를 통하여 출력되는 데이터에 필요한 메모리 공간과 연산 A를 통하여 출력되는 데이터가 필요한 연산들(예컨대, 연산 B, 연산 D)의 실행 순서를 고려하여 연산 A와 관련된 메모리 텐서(예컨대, T1)를 배치할 수 있다. 또한, 신경망 모델 최적화 장치(1000)는 연산 B를 통하여 출력되는 데이터에 필요한 메모리 공간과 연산 B를 통하여 출력되는 데이터가 필요한 연산들(예컨대, 연산 C)의 실행 순서를 고려하여 연산 B와 관련된 메모리 텐서(예컨대, T2)를 배치할 수 있다. 이때, 연산 B를 통하여 출력되는 데이터가 저장되는 T2 메모리 텐서는 연산 B에 필요한 데이터를 저장하고 있는 연산 A와 관련된 T1 메모리 텐서의 인접 위치에 배치될 수 있다. 유사한 방식으로 신경망 모델 최적화 장치(1000)는 신경망 모델을 구성하는 연산들(예컨대, 연산 C, D, E 등)을 통하여 출력되는 데이터 크기와 관련된 메모리 공간과 연산들의 실행 순서를 고려하여 제1 메모리 공간 맵을 생성할 수 있다. Obtaining a first memory space map based on the determined execution order, and performing optimization related to memory allocation based on the first memory space map ( S2400 ), the neural network
이상에서는 도 6에 도시된 제1 메모리 공간 맵을 중심으로 신경망 모델 최적화 장치(1000)의 메모리 텐서를 배치하는 동작을 설명하였다. 다만 도 6에 도시된 제1 메모리 공간 맵은 설명의 편의를 위한 예시일 뿐이며, 이에 제한적으로 해석되어서는 아니된다. In the above, the operation of arranging the memory tensor of the
도 7은 본 출원의 일 실시예에 따른 메모리 할당과 관련된 최적화의 일 양상을 도시한 도면이다. 7 is a diagram illustrating an aspect of optimization related to memory allocation according to an embodiment of the present application.
결정된 실행 순서에 기초하여 제1 메모리 공간 맵을 획득하고, 제1 메모리 공간 맵에 기초하여 메모리 할당과 관련된 최적화를 수행하는 단계(S2400)에서는, 신경망 모델 최적화 장치(1000)는 신경망 모델을 구성하는 연산들의 실행 순서 및 연산들을 통하여 출력되는 데이터 크기와 관련된 메모리 공간에 기초하여 생성된 제1 메모리 공간 맵을 획득할 수 있다. Obtaining a first memory space map based on the determined execution order, and performing optimization related to memory allocation based on the first memory space map ( S2400 ), the neural network
또한, 신경망 모델 최적화 장치(1000)는 제1 메모리 공간 맵에 기초하여 메모리 할당과 관련된 최적화를 수행할 수 있다. 일 예로, 신경망 모델 최적화 장치(1000)는 메모리 인-플레이싱(Memory In-placing) 기법을 활용하여, 특정 연산(예컨대, ReLu 연산, Add 연산, 및/또는 Sigmoid 연산 등)의 출력 공간을 해당 연산의 입력 공간에 덮어쓰는 동작을 수행할 수 있다. 구체적으로 신경망 모델 최적화 장치(1000)는 메모리 인-플레이싱 기법을 활용하여, 특정 연산(예컨대, 도 7의 제3 대상 연산(연산 C))으로 입력된 값이 저장되는 메모리 텐서(예컨대, 도 7의 T2 메모리 텐서)를 특정 연산(예컨대, 도 7의 제3 대상 연산(연산 C))를 통하여 출력된 값이 저장되는 메모리 텐서(예컨대, 도 7의 T3 메모리 텐서)로 변경하도록 구현될 수 있다. 또한, 신경망 모델 최적화 장치(1000)는 메모리 텐서의 변경 결과에 기초하여 제1 메모리 공간 맵으로부터 제2 메모리 공간 맵을 생성할 수 있다. 제2 메모리 공간 맵은 제1 메모리 공간 맵보다는 상대적으로 적은 메모리 공간을 차지하게 된다. 따라서 본 동작을 통하여 본 출원의 일 실시예에 따른 신경망 모델 최적화 방법에 의하면, 필요한 전체 메모리 공간을 줄이고, 연산들의 실행 속도를 높일 수 있다. Also, the
최적화 수행 결과에 기초하여 메모리 주소와 관련된 인스트럭션을 생성하는 단계(S2500)에서는, 신경망 모델 최적화 장치(1000)는 전술한 대상 연산 패턴에 포함된 대상 연산들의 병합 혹은 메모리 할당과 관련된 최적화 수행 결과에 기초하여, 신경망 모델을 구성하는 각 연산에 대응되는 메모리 텐서의 메모리 주소와 관련된 인스트럭션, 및/또는 신경망 모델을 구성하는 각 연산의 유형과 관련된 인스트럭션을 생성할 수 있다. In step S2500 of generating an instruction related to a memory address based on the result of the optimization, the neural network
다시 도 2를 참고하면, 본 출원의 일 실시예에 따른 신경망 모델의 최적화 방법은 임베디드 장치에 대한 최적화를 수행하고 최적 코드 정보를 획득하는 단계(S3000)를 포함할 수 있다. Referring again to FIG. 2 , the method of optimizing a neural network model according to an embodiment of the present application may include performing optimization on an embedded device and obtaining optimal code information ( S3000 ).
이하에서는 도 8 내지 9를 참고하여 본 출원의 일 실시예에 따른 임베디드 장치에 대한 신경망 모델의 최적화에 관한 내용을 보다 구체적으로 서술하도록 한다. 본 출원의 일 실시예에 따르면, 강화 학습 기법을 활용하여 임베디드 장치에 대한 신경망 모델의 최적화를 수행하도록 구현될 수 있다.Hereinafter, with reference to FIGS. 8 to 9 , content related to the optimization of a neural network model for an embedded device according to an embodiment of the present application will be described in more detail. According to an embodiment of the present application, it may be implemented to optimize a neural network model for an embedded device by using a reinforcement learning technique.
도 8은 본 출원의 일 실시예에 따른 임베디드 장치에 대한 최적화를 수행하고 최적 코드 정보를 획득하는 단계를 구체화한 순서도이다. 8 is a flowchart detailing the steps of performing optimization on an embedded device and acquiring optimal code information according to an embodiment of the present application.
본 출원의 일 실시예에 따른 임베디드 장치에 대한 최적화를 수행하고 최적 코드 정보를 획득하는 단계(S3000)는, 임베디드 장치의 컴퓨팅 환경 정보를 획득하는 단계(S3100), 강화 학습으로 훈련된 에이전트를 통하여 인스트럭션 정보에 기초하여 최적화 파라미터를 획득하는 단계(S3200), 및 최적화 파라미터에 기초하여 임베디드 장치에서 이용될 최적 코드 정보를 생성하는 단계(S3300)를 더 포함할 수 있다. The step of performing optimization for the embedded device and obtaining optimal code information according to an embodiment of the present application (S3000) includes obtaining the computing environment information of the embedded device (S3100), through an agent trained by reinforcement learning The method may further include obtaining optimization parameters based on the instruction information ( S3200 ), and generating optimal code information to be used in the embedded device based on the optimization parameters ( S3300 ).
임베디드 장치의 컴퓨팅 환경 정보를 획득하는 단계(S3100)에서는, 신경망 모델 최적화 장치(1000)는, 신경망 모델 최적화 장치(1000)는, 송수신부(1100)를 통하여, 임베디드 장치(100) 혹은 임의의 외부 장치로부터 신경망 모델이 실행될 타겟 장치인 임베디드 장치(100)의 컴퓨팅 환경 정보(예컨대, 임베디드 장치(100)의 메모리 정보 및 프로세서 정보)를 획득할 수 있다. 한편, 도 8에서는 도시하지는 않았지만, 임베디드 장치의 컴퓨팅 환경 정보를 획득하는 단계(S3100)에서는, 신경망 모델 최적화 장치(1000)는, 임베디드 장치(100)의 장치 유형 정보나 타겟 기능 정보 등 임베디드 장치(100)에서 신경망 모델을 실행시키기는 영향을 주는 변수에 대한 임의의 정보를 획득할 수 있다. In the step of acquiring the computing environment information of the embedded device ( S3100 ), the neural network
강화 학습으로 훈련된 에이전트를 통하여 인스트럭션 정보에 기초하여 최적화 파라미터를 획득하는 단계(S3200)에서는, 신경망 모델 최적화 장치(1000)는 강화 학습 기법을 활용하여 훈련된 에이전트를 이용하여, 최적 코드를 생성하기 위한 최적화 파라미터를 획득할 수 있다. In the step (S3200) of obtaining the optimization parameters based on the instruction information through the agent trained by reinforcement learning, the
강화 학습으로 훈련된 에이전트를 통하여 인스트럭션 정보에 기초하여 최적화 파라미터를 획득하는 단계(S3200)에서는, 신경망 모델 최적화 장치(1000)는, 메모리 상태 정보, 인스트럭션 정보에 포함된 연산 유형 정보, 및 임베디드 장치(100)의 컴퓨팅 환경 정보를 포함하는 임베디드 장치 정보 중 적어도 하나를 에이전트에 입력하고, 에이전트를 통하여 출력되는 최적화 파라미터를 획득할 수 있다. 여기서 최적화 파라미터란, 연산에 대하여 수행될 알고리즘 유형을 선택하는 파라미터, 연산의 블록 사이즈와 관련된 파라미터, 및/또는 코드의 길이와 관련된 파라미터를 포함하여, 신경망 모델을 실행시키기 위하여 필요한 코드와 관련된 임의의 변수와 관련될 수 있다. In the step (S3200) of obtaining optimization parameters based on instruction information through an agent trained by reinforcement learning, the neural network
일 예로, 에이전트에 입력된 연산 유형을 콘볼루션(Convolution)이라고 가정한다. 이때, 훈련이 완료된 에이전트는, 입력값에 기초하여 콘볼루션과 관련된 알고리즘, 예컨대, Im2Col 알고리즘, Default 알고리즘, 및 FFT 알고리즘 중에서 적어도 하나의 알고리즘을 선택하는 파라미터를 출력할 수 있다. 또한, 에이전트는 입력값에 기초하여 연산의 블록 사이즈와 관련된 파라미터, 및/또는 코드의 길이와 관련된 파라미터를 출력할 수 있다. 이때, 신경망 모델 최적화 장치(1000)는 에이전트를 통하여 출력된 최적화 파라미터를 획득할 수 있다. As an example, it is assumed that the type of operation input to the agent is convolution. In this case, the trained agent may output a parameter for selecting at least one algorithm from among an algorithm related to convolution, for example, an Im2Col algorithm, a Default algorithm, and an FFT algorithm, based on the input value. In addition, the agent may output a parameter related to the block size of the operation and/or a parameter related to the length of the code based on the input value. In this case, the
도 9는 본 출원의 일 실시예에 따른 강화 학습 방식을 통하여 에이전트를 훈련시키는 일 양상을 도시한 도면이다. 9 is a diagram illustrating an aspect of training an agent through a reinforcement learning method according to an embodiment of the present application.
전술한 바와 같이, 본 출원의 일 실시예에 따른 신경망 모델 최적화 장치(1000)는 '강화 학습'을 통하여 학습된 에이전트를 통하여 최적화 파라미터를 획득할 수 있다. 구체적으로 에이전트는, 초기 규칙(policy)에 기초하여, 연산 유형 정보, 메모리 상태 정보, 및 임베디드 장치 정보(혹은 타겟 장치 정보)에 수신하여 최적화 파라미터(예컨대, 알고리즘 유형을 선택하는 파라미터, 연산의 블록 사이즈와 관련된 파라미터, 및/또는 코드의 길이와 관련된 파라미터 등)와 관련된 예측값을 출력하도록 구성될 수 있다. 한편, 코드 생성기는 최적화 파라미터를 획득하고, 최적화 파라미터에 기초하여 코드를 생성할 수 있다. 이때, 생성된 코드의 성능에 대한 실행 및 평가가 수행되고, 평가 결과에 기초하여 코드의 성능에 대한 평가값을 최대화하도록(즉, 코드의 성능이 최대화되도록) 에이전트의 초기 규칙이 갱신될 수 있다. 구체적으로 코드의 성능에 대한 평가값이 최대화되는 최적화 파라미터를 출력하도록, 에이전트의 초기 규칙이 갱신되도록 학습될 수 있다. 훈련이 완료된 에이전트는 연산 유형 정보, 메모리 상태 정보, 및/또는 임베디드 장치 정보를 수신하여 최대화된 성능을 가지는 코드를 생성할 수 있는 최적화 파라미터를 출력할 수 있다. As described above, the
최적화 파라미터에 기초하여 임베디드 장치에서 이용될 최적 코드 정보를 생성하는 단계(S3300)에서는, 신경망 모델 최적화 장치(1000)는, S3200 단계에서 생성된 최적화 파라미터(예컨대, 연산에 대하여 수행될 알고리즘 유형을 선택하는 파라미터, 연산의 블록 사이즈와 관련된 파라미터, 및/또는 코드의 길이와 관련된 파라미터 등)에 기초하여 임베디드 장치(100)에서 이용될 최적 코드 정보를 생성할 수 있다. 구체적으로 신경망 모델 최적화 장치(1000)는, 코드 생성기를 통하여, 최적화 파라미터 및 해당 연산의 메모리 주소에 기초하여 최적 코드를 생성할 수 있다. 예컨대, 최적화 파라미터가 Im2Col 알고리즘, Default 알고리즘, 및 FFT 알고리즘 중에서 적어도 하나의 알고리즘(예컨대, Im2Col 알고리즘)을 선택하는 파라미터, 연산의 블록 사이즈 값과 관련된 파라미터, 및/또는 코드의 길이 값과 관련된 파라미터 중 적어도 하나를 포함하는 경우에는, 신경망 모델 최적화 장치(1000)는, 코드 생성기를 통하여, 최적화 파라미터 및 인스트럭션 정보에 포함된 연산의 메모리 주소에 기초하여, 최적 코드를 생성할 수 있다. In the step S3300 of generating optimal code information to be used in the embedded device based on the optimization parameter, the neural network
한편, 도 8에서는 도시하지는 않았지만, 본 출원의 일 실시예에 따른 최적화 파라미터에 기초하여 임베디드 장치에서 이용될 최적 코드 정보를 생성하는 단계(S3300)는, 최적화 파라미터에 기초하여 인스트럭션 정보에 대응되도록 코드를 생성하는 단계, 생성된 코드를 컴파일하여 바이너리 파일 형태로 변환하는 단계를 더 포함할 수 있다. 구체적으로 신경망 모델 최적화 장치(1000)는 최적화 파라미터에 기초하여 코드(예컨대, C 언어 코드)를 생성하고, 인스트럭션 정보에 포함된 메모리 주소에 생성된 코드를 저장할 수 있다. 또한, 신경망 모델 최적화 장치(1000)는 생성된 코드를 컴파일하여 바이너리 파일(예, API 파일)로 변환할 수 있다. 또한 신경망 모델 최적화 장치(1000)는, 송수신부(1100)를 통하여, 생성된 코드의 바이너리 파일을 임베디드 장치(100) 혹은 임의의 외부 장치로 송신할 수 있다. 본 실시예에 따르면, 최적 코드가 바이너리 파일(예컨대, API 파일) 형태로 임베디드 장치(100)로 송신됨으로써, 임베디드 장치(100)의 사용자가 최적 코드를 시각적으로 확인할 수 있다. Meanwhile, although not shown in FIG. 8 , the step of generating optimal code information to be used in the embedded device based on the optimization parameter according to an embodiment of the present application ( S3300 ) is a code corresponding to the instruction information based on the optimization parameter. It may further include the step of generating a , compiling the generated code to convert it into a binary file form. In more detail, the
본 출원의 실시예에 따른 신경망 모델 최적화 방법, 신경망 모델 최적화 장치, 및 신경망 모델 최적화 시스템에 의하면, 임베디드 장치의 하드웨어의 비표준화 문제와 기존 인공지능 실행 엔진의 구조적인 제약을 해결하고, 신경망 모델을 임베디드 장치의 하드웨어 플랫폼에 대하여 최적화시킬 수 있다. According to the neural network model optimization method, the neural network model optimization apparatus, and the neural network model optimization system according to the embodiments of the present application, the problem of hardware non-standardization of embedded devices and the structural constraints of the existing artificial intelligence execution engine are solved, and the neural network model is It can be optimized for the hardware platform of the embedded device.
본 출원의 실시예에 따른 신경망 모델 최적화 방법, 신경망 모델 최적화 장치, 및 신경망 모델 최적화 시스템에 의하면, 임베디드 장치에서의 신경망 모델의 실행 능력이 향상될 수 있다.According to the method for optimizing a neural network model, the apparatus for optimizing a neural network model, and the system for optimizing a neural network model according to an embodiment of the present application, execution capability of a neural network model in an embedded device may be improved.
본 출원의 실시예에 따른 신경망 모델 최적화 방법, 신경망 모델 최적화 장치, 및 신경망 모델 최적화 시스템에 의하면, 임베디드 장치에서 신경망 모델을 실행시키기 위하여 필요한 전력 사용량을 감소시킬 수 있다. According to the method for optimizing a neural network model, the apparatus for optimizing a neural network model, and the system for optimizing a neural network model according to an embodiment of the present application, it is possible to reduce the amount of power required to execute a neural network model in an embedded device.
상술한 신경망 모델 최적화 장치(1000)의 다양한 동작들은 신경망 모델 최적화 장치(1000)의 메모리(1200)에 저장될 수 있으며, 신경망 모델 최적화 장치(1000)의 프로세서(1300)는 메모리(1200)에 저장된 동작들을 수행하도록 제공될 수 있다. Various operations of the
본 출원에 개시된 신경망 모델 최적화 방법, 신경망 모델 최적화 장치 및 신경망 모델 최적화 시스템은 가전 제품, 차량용 센서, 유아 혹은 노인의 안전을 위한 제품 및 스마트 워치 등을 포함하여 다양한 임베디드 시스템에서의 인공지능 모델의 효율적인 실행을 위하여 이용될 수 있다. The neural network model optimization method, neural network model optimization device, and neural network model optimization system disclosed in the present application are effective in artificial intelligence models in various embedded systems, including home appliances, vehicle sensors, safety products for infants or the elderly, and smart watches. can be used for execution.
이상에서 실시 형태들에 설명된 특징, 구조, 효과 등은 본 발명의 적어도 하나의 실시 형태에 포함되며, 반드시 하나의 실시 형태에만 한정되는 것은 아니다. 나아가, 각 실시 형태에서 예시된 특징, 구조, 효과 등은 실시 형태들이 속하는 분야의 통상의 지식을 가지는 자에 의해 다른 실시 형태들에 대해서도 조합 또는 변형되어 실시 가능하다. 따라서 이러한 조합과 변형에 관계된 내용들은 본 발명의 범위에 포함되는 것으로 해석되어야 할 것이다.Features, structures, effects, etc. described in the above embodiments are included in at least one embodiment of the present invention, and are not necessarily limited to only one embodiment. Furthermore, the features, structures, effects, etc. illustrated in each embodiment can be combined or modified for other embodiments by those of ordinary skill in the art to which the embodiments belong. Accordingly, the contents related to such combinations and modifications should be interpreted as being included in the scope of the present invention.
또한, 이상에서 실시 형태를 중심으로 설명하였으나 이는 단지 예시일 뿐 본 발명을 한정하는 것이 아니며, 본 발명이 속하는 분야의 통상의 지식을 가진 자라면 본 실시 형태의 본질적인 특성을 벗어나지 않는 범위에서 이상에 예시되지 않은 여러 가지의 변형과 응용이 가능함을 알 수 있을 것이다. 즉, 실시 형태에 구체적으로 나타난 각 구성 요소는 변형하여 실시할 수 있는 것이다. 그리고 이러한 변형과 응용에 관계된 차이점들은 첨부된 청구 범위에서 규정하는 본 발명의 범위에 포함되는 것으로 해석되어야 할 것이다.In addition, although the embodiment has been mainly described in the above, this is only an example and does not limit the present invention, and those of ordinary skill in the art to which the present invention pertains in the range that does not deviate from the essential characteristics of the present embodiment. It will be appreciated that various modifications and applications not illustrated are possible. That is, each component specifically shown in the embodiment can be implemented by modification. And the differences related to these modifications and applications should be construed as being included in the scope of the present invention defined in the appended claims.
10: 신경망 모델 최적화 시스템
100: 임베디드 장치
1000: 신경망 모델 최적화 장치10: Neural Network Model Optimization System
100: embedded device
1000: Neural network model optimizer
Claims (7)
학습이 완료된 신경망 모델의 실행 데이터를 획득하는 단계-상기 실행 데이터는 상기 신경망 모델의 계층 데이터, 상기 신경망 모델을 구성하는 연산 데이터(operation data) 및 상기 신경망 모델의 파라미터 중 적어도 하나를 포함함-;
상기 신경망 모델의 실행 데이터에 기초하여 상기 신경망 모델의 구조에 대한 최적화를 수행하고 인스트럭션 정보를 획득하는 단계-상기 인스트럭션 정보는 연산의 유형, 및 메모리 주소 중 적어도 하나와 관련된 정보를 포함함-;
상기 인스트럭션 정보에 기초하여 상기 신경망 모델이 구동될 임베디드 장치에 대한 최적화를 수행하고 최적 코드 정보를 획득하는 단계; 및
상기 최적 코드 정보를 송신하는 단계;를 포함하되,
상기 최적 코드 정보를 획득하는 단계는,
상기 임베디드 장치의 컴퓨팅 환경 정보를 획득하는 단계;
강화 학습으로 훈련된 에이전트를 통하여, 상기 인스트럭션 정보 및 상기 컴퓨팅 환경 정보로부터 최적화 파라미터를 획득하는 단계; 및
상기 최적화 파라미터에 기초하여 상기 임베디드 장치에서 이용될 코드 정보를 생성하는 단계;를 더 포함하되,
상기 최적화 파라미터는,
상기 연산의 유형과 관련된 제1 알고리즘 유형과 제2 알고리즘 유형 중 하나의 알고리즘 유형을 선택하는 파라미터를 포함하되,
상기 에이전트는,
초기 규칙에 따라, 타겟 임베디드 장치의 컴퓨팅 환경과 관련된 타겟 장치 정보, 메모리 상태 정보, 및 연산(operation)에 대응되는 적어도 하나 이상의 알고리즘 유형 정보에 기초하여 최적화 파라미터에 대응되는 예측값을 출력하도록 구성되되, 상기 예측값에 기반하여, 코드 생성기를 통하여 생성된 코드의 성능에 대한 평가값을 획득하고, 상기 평가값이 최대화되도록 상기 초기 규칙이 갱신됨으로써 훈련되는 것을 특징으로 하는,
신경망 모델 최적화 방법.
A method for optimizing a neural network model in consideration of the computing environment of an embedded device in which the neural network model is to be driven, by a neural network model optimization device that performs optimization on the neural network model based on the execution data of the neural network model that has been trained, the method comprising:
obtaining execution data of a neural network model on which training has been completed, wherein the execution data includes at least one of hierarchical data of the neural network model, operation data constituting the neural network model, and parameters of the neural network model;
performing optimization on the structure of the neural network model and obtaining instruction information based on the execution data of the neural network model, wherein the instruction information includes information related to at least one of a type of operation and a memory address;
performing optimization on an embedded device in which the neural network model is to be driven based on the instruction information and obtaining optimal code information; and
Including; transmitting the optimal code information;
The step of obtaining the optimal code information includes:
acquiring computing environment information of the embedded device;
obtaining optimization parameters from the instruction information and the computing environment information through an agent trained by reinforcement learning; and
Generating code information to be used in the embedded device based on the optimization parameter;
The optimization parameters are
a parameter for selecting one of a first algorithm type and a second algorithm type associated with the type of operation;
The agent is
configured to output a predicted value corresponding to an optimization parameter based on target device information related to the computing environment of the target embedded device, memory state information, and at least one or more algorithm type information corresponding to an operation according to the initial rule, Based on the predicted value, an evaluation value of the performance of the generated code is obtained through a code generator, and the initial rule is updated so that the evaluation value is maximized, whereby training is performed,
How to optimize neural network models.
상기 최적화 파라미터를 획득하는 단계는,
상기 연산에 대응되는 적어도 하나 이상의 연산 유형 정보, 메모리 상태 정보, 및 상기 임베디드 장치의 컴퓨팅 환경 정보 중 적어도 하나를 상기 에이전트에 입력하는 단계; 및
상기 에이전트를 통하여 출력되는 최적화 파라미터를 획득하는 단계;를 더 포함하는,
신경망 모델 최적화 방법.
The method of claim 1,
The step of obtaining the optimization parameter comprises:
inputting at least one of at least one operation type information corresponding to the operation, memory state information, and computing environment information of the embedded device to the agent; and
Obtaining an optimization parameter output through the agent; further comprising,
How to optimize neural network models.
상기 최적화 파라미터는,
상기 연산의 블록 사이즈와 관련된 파라미터, 및 코드의 길이와 관련된 파라미터 중 적어도 하나를 더 포함하는,
신경망 모델 최적화 방법.
3. The method of claim 2,
The optimization parameters are
Further comprising at least one of a parameter related to the block size of the operation, and a parameter related to the length of the code,
How to optimize neural network models.
상기 임베디드 장치에서 이용될 코드 정보를 생성하는 단계는,
상기 최적화 파라미터에 기초하여 상기 인스트럭션 정보에 대응되도록 코드를 생성하는 단계; 및
상기 생성된 코드를 컴파일하여 바이너리 파일 형태로 변환하는 단계;를 더 포함하는,
신경망 모델 최적화 방법.
The method of claim 1,
The step of generating code information to be used in the embedded device comprises:
generating a code corresponding to the instruction information based on the optimization parameter; and
Compiling the generated code and converting it into a binary file form; further comprising,
How to optimize neural network models.
A computer-readable recording medium in which a program for executing the method according to any one of claims 1 to 3 and 5 is recorded on a computer.
학습이 완료된 신경망 모델의 실행 데이터 및 신경망 모델이 구동될 임베디드 장치의 컴퓨팅 환경 정보를 획득하는 송수신부; 및
상기 실행 데이터 및 상기 임베디드 장치의 컴퓨팅 환경 정보에 기초하여 상기 신경망 모델에 대한 최적화를 수행하는 프로세서;를 포함하되,
상기 프로세서는,
학습이 완료된 신경망 모델의 실행 데이터-상기 실행 데이터는 상기 신경망 모델의 계층 데이터, 상기 신경망 모델을 구성하는 연산 데이터(operation data), 및 상기 신경망 모델의 파라미터 중 적어도 하나를 포함함-를 획득하고, 상기 신경망 모델의 실행 데이터에 기초하여 상기 신경망 모델의 구조에 대한 최적화를 수행하고 인스트럭션 정보-상기 인스트럭션 정보는 연산의 유형, 및 메모리 주소 중 적어도 하나와 관련된 정보를 포함함-를 획득하고, 상기 인스트럭션 정보에 기초하여 상기 신경망 모델이 구동될 임베디드 장치에 대한 최적화를 수행하고 최적 코드 정보를 획득하고, 상기 최적 코드 정보를 송신하도록 구성되되,
상기 프로세서는,
상기 임베디드 장치의 컴퓨팅 환경 정보를 획득하고, 강화 학습으로 훈련된 에이전트를 통하여, 상기 인스트럭션 정보 및 상기 컴퓨팅 환경 정보로부터 최적화 파라미터를 획득하고, 상기 최적화 파라미터에 기초하여 상기 임베디드 장치에서 이용될 코드 정보를 생성함으로써 상기 최적 코드 정보를 획득하도록 구성되되,
상기 최적화 파라미터는,
상기 연산의 유형과 관련된 제1 알고리즘 유형과 제2 알고리즘 유형 중 하나의 알고리즘 유형을 선택하는 파라미터를 포함하되,
상기 에이전트는,
초기 규칙에 따라, 타겟 임베디드 장치의 컴퓨팅 환경과 관련된 타겟 장치 정보, 메모리 상태 정보, 및 연산(operation)에 대응되는 적어도 하나 이상의 알고리즘 유형 정보에 기초하여 최적화 파라미터에 대응되는 예측값을 출력하도록 구성되되, 상기 예측값에 기반하여, 코드 생성기를 통하여 생성된 코드의 성능에 대한 평가값을 획득하고, 상기 평가값이 최대화되도록 상기 초기 규칙이 갱신됨으로써 훈련되는 것을 특징으로 하는,
신경망 모델 최적화 장치.In the neural network model optimization device for performing optimization on the neural network model based on the execution data of the trained neural network model and the computing environment of the embedded device in which the neural network model is to be driven,
a transceiver for acquiring execution data of the neural network model that has been trained and computing environment information of an embedded device in which the neural network model is to be driven; and
A processor for performing optimization on the neural network model based on the execution data and the computing environment information of the embedded device;
The processor is
Acquiring the execution data of the neural network model on which learning is completed, the execution data including at least one of hierarchical data of the neural network model, operation data constituting the neural network model, and parameters of the neural network model; performing optimization on the structure of the neural network model based on execution data of the neural network model, and obtaining instruction information, wherein the instruction information includes information related to at least one of a type of operation and a memory address; configured to perform optimization on an embedded device in which the neural network model is to be driven based on the information, obtain optimal code information, and transmit the optimal code information,
The processor is
Acquire computing environment information of the embedded device, obtain optimization parameters from the instruction information and the computing environment information through an agent trained by reinforcement learning, and obtain code information to be used in the embedded device based on the optimization parameters configured to obtain the optimal code information by generating,
The optimization parameters are
a parameter for selecting one of a first algorithm type and a second algorithm type associated with the type of operation;
The agent is
configured to output a predicted value corresponding to an optimization parameter based on target device information related to the computing environment of the target embedded device, memory state information, and at least one or more algorithm type information corresponding to an operation according to the initial rule, Based on the predicted value, an evaluation value of the performance of the generated code is obtained through a code generator, and the initial rule is updated so that the evaluation value is maximized, whereby training is performed,
Neural network model optimizer.
Priority Applications (3)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
KR1020220023380A KR102462001B1 (en) | 2022-02-23 | 2022-02-23 | Method, device, and system for optimizing a neural network model to be executed on imbedded device |
KR1020220140648A KR20230126630A (en) | 2022-02-23 | 2022-10-27 | Method, device, and system for optimizing a neural network model to be executed on imbedded device |
PCT/KR2023/002279 WO2023163453A1 (en) | 2022-02-23 | 2023-02-16 | Neural network model optimization method to be executed in embedded device, neural network model optimization apparatus, and neural network model optimization system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
KR1020220023380A KR102462001B1 (en) | 2022-02-23 | 2022-02-23 | Method, device, and system for optimizing a neural network model to be executed on imbedded device |
Related Child Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
KR1020220140648A Division KR20230126630A (en) | 2022-02-23 | 2022-10-27 | Method, device, and system for optimizing a neural network model to be executed on imbedded device |
Publications (1)
Publication Number | Publication Date |
---|---|
KR102462001B1 true KR102462001B1 (en) | 2022-11-03 |
Family
ID=84041124
Family Applications (2)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
KR1020220023380A KR102462001B1 (en) | 2022-02-23 | 2022-02-23 | Method, device, and system for optimizing a neural network model to be executed on imbedded device |
KR1020220140648A KR20230126630A (en) | 2022-02-23 | 2022-10-27 | Method, device, and system for optimizing a neural network model to be executed on imbedded device |
Family Applications After (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
KR1020220140648A KR20230126630A (en) | 2022-02-23 | 2022-10-27 | Method, device, and system for optimizing a neural network model to be executed on imbedded device |
Country Status (1)
Country | Link |
---|---|
KR (2) | KR102462001B1 (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2023163453A1 (en) * | 2022-02-23 | 2023-08-31 | 주식회사 에너자이 | Neural network model optimization method to be executed in embedded device, neural network model optimization apparatus, and neural network model optimization system |
CN117706987A (en) * | 2023-12-05 | 2024-03-15 | 广东全芯半导体有限公司 | Main control chip control system |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR102257028B1 (en) * | 2020-10-06 | 2021-05-27 | 주식회사 딥이티 | Apparatus and method for allocating deep learning task adaptively based on computing platform |
-
2022
- 2022-02-23 KR KR1020220023380A patent/KR102462001B1/en active IP Right Grant
- 2022-10-27 KR KR1020220140648A patent/KR20230126630A/en unknown
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR102257028B1 (en) * | 2020-10-06 | 2021-05-27 | 주식회사 딥이티 | Apparatus and method for allocating deep learning task adaptively based on computing platform |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2023163453A1 (en) * | 2022-02-23 | 2023-08-31 | 주식회사 에너자이 | Neural network model optimization method to be executed in embedded device, neural network model optimization apparatus, and neural network model optimization system |
CN117706987A (en) * | 2023-12-05 | 2024-03-15 | 广东全芯半导体有限公司 | Main control chip control system |
Also Published As
Publication number | Publication date |
---|---|
KR20230126630A (en) | 2023-08-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR102462001B1 (en) | Method, device, and system for optimizing a neural network model to be executed on imbedded device | |
CN111652368B (en) | Data processing method and related product | |
CN109032078B (en) | Machine learning apparatus, control apparatus, and computer-readable medium | |
JP6648352B2 (en) | Generating a general-purpose trained model | |
KR102521054B1 (en) | Method of controlling computing operations based on early-stop in deep neural network | |
KR102462002B1 (en) | Method, device, and system for optimizing a neural network model to be executed on imbedded device | |
CN109891855B (en) | Method and apparatus for sensor and/or actuator data processing on a server | |
US20210312295A1 (en) | Information processing method, information processing device, and information processing program | |
US20160098284A1 (en) | Dynamic device drivers | |
US11630982B1 (en) | Constraint-based dynamic quantization adjustment for fixed-point processing | |
US20220222584A1 (en) | Heterogeneous compute-based artificial intelligence model partitioning | |
CN114691765A (en) | Data processing method and device in artificial intelligence system | |
KR20230071059A (en) | Method for, device for, and system for lightnening of neural network model | |
KR20230071060A (en) | Method for, device for, and system for lightnening of neural network model | |
KR20200023660A (en) | Electronic device for controlling performance of at least one processor when providing inference service through deep learning model and operating method thereof | |
CN113159318B (en) | Quantification method and device of neural network, electronic equipment and storage medium | |
KR102393767B1 (en) | Method for, device for, and system for optimizing an inference engine | |
CN112052943A (en) | Electronic device and method for performing operation of the same | |
JP6418833B2 (en) | Control system, optimum solution selection device, control method, and program | |
Ahn et al. | Scissionlite: Accelerating distributed deep neural networks using transfer layer | |
Mahmoodi et al. | Spectrum-Aware Mobile Computing | |
KR20230024835A (en) | Method and system for predicting latency of deep learning model in device | |
KR102581614B1 (en) | Method for, device for, and system for optimizing an inference engine | |
US20230044533A1 (en) | Information processing system, information processing method, and storage medium | |
KR102573644B1 (en) | Method for, device for, and system for optimizing an inference engine |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
E701 | Decision to grant or registration of patent right | ||
A107 | Divisional application of patent | ||
GRNT | Written decision to grant |