WO2022097902A1 - 전자 장치 및 이의 제어 방법 - Google Patents

전자 장치 및 이의 제어 방법 Download PDF

Info

Publication number
WO2022097902A1
WO2022097902A1 PCT/KR2021/012448 KR2021012448W WO2022097902A1 WO 2022097902 A1 WO2022097902 A1 WO 2022097902A1 KR 2021012448 W KR2021012448 W KR 2021012448W WO 2022097902 A1 WO2022097902 A1 WO 2022097902A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
bit
module
input data
identified
Prior art date
Application number
PCT/KR2021/012448
Other languages
English (en)
French (fr)
Inventor
윤정인
최성필
이정훈
Original Assignee
삼성전자주식회사
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 삼성전자주식회사 filed Critical 삼성전자주식회사
Priority to US17/527,305 priority Critical patent/US20220147806A1/en
Publication of WO2022097902A1 publication Critical patent/WO2022097902A1/ko

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F5/00Methods or arrangements for data conversion without changing the order or content of the data handled
    • G06F5/01Methods or arrangements for data conversion without changing the order or content of the data handled for shifting, e.g. justifying, scaling, normalising
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F5/00Methods or arrangements for data conversion without changing the order or content of the data handled
    • G06F5/01Methods or arrangements for data conversion without changing the order or content of the data handled for shifting, e.g. justifying, scaling, normalising
    • G06F5/012Methods or arrangements for data conversion without changing the order or content of the data handled for shifting, e.g. justifying, scaling, normalising in floating-point computations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology

Definitions

  • the present disclosure relates to an electronic device and a control method thereof, and more particularly, to an electronic device and a control method thereof for efficiently performing calculations on weights and input data on an artificial intelligence model.
  • the artificial intelligence system is a system in which the machine learns, judges, and becomes smarter by itself.
  • Machine learning e.g. deep learning
  • Machine learning algorithms may refer to algorithm technology that classifies/learns characteristics of input data by itself.
  • the present disclosure has been devised to solve the above problems, and an object of the present disclosure relates to an electronic device for performing an operation between weight data and input data based on artificial intelligence technology, and a control method thereof.
  • the electronic device includes a memory for storing first input data and first weight data used for calculation of a neural network model, and inputting the first input data and the first weight data to a first module, Obtaining second input data in which a part of the first input data is truncated and second weight data in which a part of the first weight data is removed, and multiplying the second input data by the second weight data to obtain first output data by input to a second module that performs
  • the processor may include a processor configured to obtain second output data by converting a first bit of the first output data into a floating point format representing a unit scale.
  • a control method of an electronic device including a memory for storing first input data and first weight data used for calculation of a neural network model includes first input data and first weight data inputting to a module to obtain second input data from which a part of the first input data is truncated and second weight data from which a part of the first weight data is removed; the second input data and the second input data; inputting weight data into a second module that performs a multiplication operation to obtain first output data, and based on the first input data identified through the first module and a scaling factor of the first weight data, the The method may include converting the obtained first output data into a floating-point form representing a first bit on a unit scale to obtain second output data.
  • the electronic device can efficiently perform an operation between the weight value and the input data even on a terminal device including a limited resource.
  • FIG. 1 is a block diagram schematically illustrating a configuration of an electronic device according to an embodiment of the present disclosure.
  • FIG. 2 is a diagram for describing a structure and operation of an electronic device performing an operation between input data and weight data, according to an embodiment of the present disclosure
  • 3A and 3B are diagrams for explaining a process in which an electronic device removes some of input data and weight data, according to an embodiment of the present disclosure
  • FIG. 4 is a diagram for describing a floating-point form in which a first bit is represented by a unit scale, according to an embodiment of the present disclosure.
  • 5A and 5B are diagrams for explaining an operation of adding between output data by an electronic device according to an embodiment of the present disclosure
  • 6A and 6B are diagrams for explaining an operation of normalizing output data by an electronic device according to an embodiment of the present disclosure
  • FIG. 7 is a detailed block diagram illustrating the configuration of an electronic device according to an embodiment of the present disclosure.
  • FIG. 8 is a flowchart illustrating a method of controlling an electronic device according to an embodiment of the present disclosure.
  • expressions such as “have,” “may have,” “include,” or “may include” indicate the presence of a corresponding characteristic (eg, a numerical value, function, operation, or component such as a part). and does not exclude the presence of additional features.
  • expressions such as “A or B,” “at least one of A and/and B,” or “one or more of A or/and B” may include all possible combinations of the items listed together.
  • “A or B,” “at least one of A and B,” or “at least one of A or B” means (1) includes at least one A, (2) includes at least one B; Or (3) it may refer to all cases including both at least one A and at least one B.
  • a component eg, a first component
  • another component eg, a second component
  • the certain element may be directly connected to the other element or may be connected through another element (eg, a third element).
  • a component eg, a first component
  • another component eg, a second component
  • the expression “a device configured to” may mean that the device is “capable of” with other devices or parts.
  • a processor configured (or configured to perform) A, B, and C refers to a dedicated processor (eg, an embedded processor) for performing the corresponding operations, or by executing one or more software programs stored in a memory device.
  • a generic-purpose processor eg, a central processing unit (CPU) or an application processor capable of performing corresponding operations.
  • a 'module' or 'unit' performs at least one function or operation, and may be implemented as hardware or software, or a combination of hardware and software.
  • a plurality of 'modules' or a plurality of 'units' may be integrated into at least one module and implemented with at least one processor, except for 'modules' or 'units' that need to be implemented with specific hardware.
  • the present disclosure reduces the size of a module including logic for performing a multiplication operation between input data and weight data by truncation of an adaptive bit for each of input data and weight data, and a result value of performing the multiplication operation
  • the present invention relates to an electronic device for reducing the word size of a buffer for storing a result value by converting a first bit into a floating point form representing a unit scale, and a control method therefor.
  • FIG. 1 is a block diagram schematically illustrating a configuration of an electronic device 100 according to an embodiment of the present disclosure.
  • the electronic device 100 may include a memory 110 and a processor 120 .
  • the configuration shown in FIG. 1 is an exemplary diagram for implementing embodiments of the present disclosure, and appropriate hardware and software configurations at a level obvious to those skilled in the art may be additionally included in the electronic device 100 .
  • the electronic device 100 is a device for acquiring output data for input data using learning, compression, or a neural network model of a neural network model (or artificial intelligence model).
  • the electronic device 100 may be implemented as a desktop PC, a notebook computer, a smart phone, a tablet PC, a server, or the like.
  • various operations performed by the electronic device 100 may be performed by a system in which a cloud computing environment is built.
  • a system in which a cloud computing environment is built may quantize the weights included in the neural network model, and may perform an operation between the quantized data and the input data.
  • the memory 110 may store commands or data related to at least one other component of the electronic device 100 .
  • the memory 110 is accessed by the processor 120 , and reading/writing/modification/deletion/update of data by the processor 120 may be performed.
  • the term "memory” refers to the memory 110, a ROM (not shown) in the processor 120, a RAM (not shown), or a memory card (not shown) mounted in the electronic device 100 (eg, micro secure). digital (SD) card, memory stick).
  • programs and data for configuring various screens to be displayed in the display area of the display may be stored in the memory 110 .
  • the memory 110 may include a non-volatile memory capable of maintaining the stored information even if the power supply is interrupted, and a volatile memory requiring continuous power supply to maintain the stored information.
  • the nonvolatile memory may be implemented with at least one of one time programmable ROM (OTPROM), programmable ROM (PROM), erasable and programmable ROM (EPROM), electrically erasable and programmable ROM (EEPROM), mask ROM, and flash ROM
  • OTPROM programmable ROM
  • PROM programmable ROM
  • EPROM erasable and programmable ROM
  • EEPROM electrically erasable and programmable ROM
  • the volatile memory may be implemented as at least one of dynamic RAM (DRAM), static RAM (SRAM), or synchronous dynamic RAM (SDRAM).
  • DRAM dynamic RAM
  • SRAM static RAM
  • SDRAM synchronous dynamic RAM
  • the volatile memory may be implemented in a form included in the processor 120 as a component of the processor 120 , but this is only
  • the memory 110 may store weight data used for calculation of the neural network model. That is, the memory 110 may store a plurality of weight data included in a plurality of layers constituting the neural network model.
  • the weight data may include a plurality of weight values included in the weight data.
  • the weight data may be data implemented based on integers, and may be expressed through at least one of a vector, a matrix, or a tensor.
  • the memory 110 may store various types of input data.
  • the memory 110 may store voice data input through a microphone, image data or text data input through an input unit (eg, camera, keyboard, etc.).
  • the input data stored in the memory 110 may include data received through an external device.
  • Each of the weight data and the input data may include sign data.
  • the sign data may refer to data including a value indicating only a sign without changing the size of each data.
  • the sign data When specific data is a positive number, the sign data may be implemented as 0, and when the specific data is a negative number, the sign data may be implemented as 1.
  • the present invention is not limited thereto, and the code of each data may be expressed in various ways.
  • the memory 110 may store data necessary for the first module, the second module, the third module, and the fourth module to perform various operations. Data necessary for the first module, the second module, the third module, and the fourth module to perform various operations may be stored in the nonvolatile memory. A description of each module will be provided in a later section.
  • the memory 110 may include a buffer (or an accumulation buffer) for storing the converted output data in a floating-point format representing the first bit on a unit scale.
  • the processor 120 may be electrically connected to the memory 110 to control overall operations and functions of the electronic device 100 .
  • the processor 120 may include one or a plurality of processors to control the operation of the electronic device 100 .
  • the processor 120 may load data necessary for the first module, the second module, the third module, and the fourth module to perform various operations from the nonvolatile memory to the volatile memory.
  • Loading refers to an operation of loading and storing data stored in the non-volatile memory into the volatile memory so that the processor 120 can access it.
  • the processor 120 may perform an operation between the input data and the first weight data by using each module. Each operation of the processor 120 will be described in detail with reference to FIGS. 2 to 6B .
  • the processor 120 inputs the first input data 10-1 and the first weight data 10-2 to the first module 20 to remove some of the first input data.
  • the truncated second input data 35 - 1 and the second weight data 35 - 2 may be obtained.
  • the first input data 10-1 and the first weight data 10-2 are both input to the first module 20 as a single module, but this is only an exemplary embodiment.
  • the first module 20 is a module that outputs the second input data 35-1 using the first input data 10-1, and a second weight value using the input first weight data 10-2. It can be divided into modules that output data 35 - 2 . That is, the first module 20 may be divided into separate modules to which each of the first input data 10-1 and the first weight data 10-2 is input.
  • the first module 20 may be expressed as an adaptive truncation module.
  • the first module 20 identifies the most significant bit including a valid value among the upper second bits based on the Most Significant Bit (MSB) except for the sign data of the input data, and the identified most significant bit Based on the LSB (Least Significant Bit) of the input data (eg, the first input data and/or the first weight data), a scaling factor indicating a lower bit to be removed is identified, and the An operation of removing some of the input data may be performed based on the operation.
  • MSB Most Significant Bit
  • LSB Least Significant Bit
  • the first module 20 may identify the most significant bit including the valid value among the second higher bits based on the MSB 302 of the input data 300 .
  • the MSB 302 of the input data 300 may mean the most significant bit except for the sign data 301 .
  • the input data 300 may be one of the first input data 10 - 1 and the first weight data 10 - 2 .
  • the first module 20 may identify that the input data 300 is a positive number. In addition, the first module 20 may identify the most significant bit including the valid value among the second higher bits (eg, 6 bits) based on the MSB 302 . Since the input data 300 is a positive number, a valid value may be 1. That is, the first module 20 may detect the most significant bit (leading 1) including 1 among the second higher bits based on the MSB.
  • the second higher bits eg, 6 bits
  • the first module 20 may identify that the input data 320 is a negative number. In addition, the first module 20 may identify the most significant bit including a valid value among the second higher bits (eg, 6 bits) based on the MSB 322 . Since the input data 320 is a negative number, a valid value may be 0. That is, the first module 20 may detect the most significant bit (leading 0) including 0 among the second higher bits based on the MSB.
  • the first module 20 may detect the most significant bit (leading 0) including 0 among the second higher bits based on the MSB.
  • the processor 120 identifies, through the first module 20 , a first most significant bit including a valid value among the second bits of the first input data 10 - 1 , and among the second bits, the first most significant bit A higher third bit may be identified, and a difference between the second bit and the third bit may be identified as a first scaling factor 30 - 1 corresponding to the first input data 10 - 1 .
  • the first scaling factor may mean the number of data bits removed based on the LSB of the first input data 10 - 1 . For example, when 2 bits are removed based on the LSB of the first input data, the scaling factor is 2.
  • the second bit is bit 6 as shown in FIG. 3A .
  • the processor 120 determines a valid value among 6 high-order bits based on the MSB 302 of the 16-bit data input through the first module 20 (eg, the first input data 10-1) 300 .
  • the included first most significant bit may be identified.
  • the processor 120 performs a third bit (eg, sign data 301) located higher than the first most significant bit 303 except for sign data. and 4 bits including 0 between the first most significant bit 303) may be identified.
  • the processor 120 may identify 2, which is a number corresponding to 2 bits, which is a difference between the second bit (eg, 6 bits) and the third bit (4 bits), as the first scaling factor through the first module 20 .
  • the second bit is bit 6 .
  • the processor 120 is valid among 6 high-order bits based on the MSB 332 of the 16-bit data input through the first module 20 (eg, the first input data 10-1) 320 .
  • the first most significant bit including the value may be identified.
  • the processor 120 performs a third bit (eg, sign data 301 ) located higher than the first most significant bit 323 except for sign data. and 3 bits including 0 between the first most significant bit 323) may be identified.
  • the processor 120 may identify 3, which is a number corresponding to 3 bits, which is a difference between the second bit (eg, bit 6) and the third bit (bit 3), as the first scaling factor through the first module 20 . .
  • the processor 120 may process the first weight data 10-2 through the first module 20 in the same manner as processing the first input data 10-1.
  • the processor 120 identifies, through the first module 20 , a second most significant bit including a valid value among the second bits of the first input data 10 - 1 , and a second most significant bit among the second bits
  • a fourth bit positioned higher than the fourth bit may be identified, and a difference between the second bit and the fourth bit may be identified as a second scaling factor 30 - 2 corresponding to the first weight data 10 - 2 .
  • the second scaling factor may mean the number of data bits removed based on the LSB of the first weight data 10 - 2 .
  • the processor 120 obtains the second input data by removing the data corresponding to the third bit and the data corresponding to the first scaling factor among the first input data 10 - 1 through the first module 20 . can do. For example, referring to FIG. 3A , it is assumed that the input positive data 300 is the first input data 10 - 1 .
  • the processor 120 removes a 4bit third bit including 0 between the sign data 301 and the first most significant bit 303,
  • the second input data 320 may be obtained by removing the data 304 and 305 . That is, the processor 120 may convert 16-bit first input data into 10-bit second input data through the first module 20 .
  • the processor 120 may obtain the second weight data by removing the data corresponding to the fourth bit and the data corresponding to the second scale factor among the first weight data through the first module 20 .
  • the input negative data 320 is the first weight data 10 - 2 .
  • the processor 120 removes the fourth bit, which is 3 bits including 1, between the sign data and the second most significant bit 323, and 3 bits of data (324, 325, 326) corresponding to the second scaling factor (eg, 3)
  • the second weight data 330 may be obtained. That is, the processor 120 may convert 16-bit first weight data into 10-bit second weight data through the first module 20 .
  • the second bit may be a value preset through experiments or research.
  • the second bit may be changed according to the type of result to be output through the neural network model.
  • the processor 120 may identify the type of the calculation result to be output through the neural network model.
  • the processor 120 may identify the arithmetic precision required to output a result of the identified type.
  • the processor 120 determines the size of the second bit as a first value as the identified arithmetic accuracy is higher, and determines the size of the second bit as a second value greater than the first value as the identified arithmetic accuracy is lower.
  • the accuracy of an operation required to perform a classification operation is that of an operation required to perform a regression operation such as a super-resolution operation. It may be less accurate. Accordingly, when the neural network model performs the classification operation, the processor 120 determines the size of the second bit to be 8 bits, and when the neural network model performs the regression operation, the processor 120 determines the size of the second bit can be set to 4 bits. In this case, the numerical value determined by the size of the second bit may be a result calculated through research or experiment.
  • the processor 120 may reduce the amount of power consumed in the calculation by variably adjusting the number of bits to be removed based on the calculation accuracy required to output a specific type of result through the neural network model.
  • the processor 120 inputs the second input data 35-1 and the second weight data 35-2 to the second module 40 that performs a multiplication operation to perform a first output data ( 45) can be obtained.
  • the second module 40 may be implemented as a hardware module including logic for performing a multiply operation, and may be expressed as a multiplication operation module. However, this is only an embodiment and the second module 40 may be implemented as a software module.
  • the processor 120 variably removes bits for each of the first input data 10-1 and the first weight data 10-2. size can be reduced.
  • the first input data 10-1 of 16 bits and the first weight data 10-2 are the second input data 35-1 and the second weight of 10 bits.
  • the second module may perform an operation even if it includes only logic for performing 10 bits x 10 bits. Accordingly, the area occupied by the second module performing the multiplication operation and power consumed to perform the product operation may be reduced.
  • the processor 120 obtains a third scaling factor by summing the scaling factors of each of the first input data 10-1 and the first weight data 10-2 identified through the first module 20, and
  • the second output data 55 may be obtained by inputting the 3 scale value and the first output data 45 to the third module 50 .
  • the third module 50 may be expressed as a scale transformation module.
  • the processor 120 generates a first scaling factor 30-1 corresponding to the first input data 10-1 and a second scaling factor 30-2 corresponding to the second input data 10-2. ) to obtain a third scaling factor.
  • the processor 120 converts the obtained first output data into a floating-point format (eg, a quantum floating point format) representing the first bit in a unit scale, based on the third scaling factor. to obtain the second output data.
  • the processor 120 may obtain the second output data 55 based on the third scaling factor and the first output data 45 through the third module 50 .
  • the third module 50 converts the third scaling factor into a unit scale form, removes a lower fifth bit based on the LSB of the first output data based on the converted unit scale, and guards by the removed fifth bit
  • the quantum floating-point form will be described in detail with reference to FIG. 4 .
  • the quantum floating-point form converts (or expresses) the scale in units of the first bit (eg, I (I is an integer) bit), and the mantissa is the existing It may mean a form having the same structure as a fixed-point of .
  • the index scale 425 may mean a scale in which an existing scale is converted in units of first bits.
  • the converted data 400 includes 1 bit for the sign data 410, an E (E is an integer) bit(s) representing the index scale 425, and an S (S is an integer) bit(s) representing the mantissa. can do.
  • the mantissa unit may include a guard bit, which is an I bit, for preparing for overflow, and an S-I bit for expressing a significant number, and the like.
  • the first bit is bit 8.
  • the scale of the first data 450 may be shifted by 8 bits to be converted (or expressed) into the second data 460 .
  • the scale of the first data 450 may be shifted by 8 bits to be converted (or expressed) into the second data 460 .
  • the E bit that may represent the index scale is 3 bits and the index scale may have a scale of 0 to 4, the range of S+4I+1 may be expressed on an integer basis.
  • the processor 120 may identify, through the third module 50 , that the third scaling factor (eg, 5) is not expressed in units of multiples of the first bit. In this case, the processor 120 may identify a minimum number (eg, 8) among numbers that are greater than the third scaling factor value and can be expressed in units of multiples of the first bit through the third module 50 . At this time, since one unit scale is 8 bits, it may be 1 when the identified minimum number (eg, 8) is converted to the index scale.
  • the processor 120 converts the third scaling factor into an index scale corresponding to the identified minimum number through the third module 50, and based on the LSB of the first output data based on the converted minimum number, the fifth
  • the second output data may be output by removing bits and adding guard bits as much as the removed fifth bits.
  • the fifth lower bit may mean a bit located in the lower region with respect to the LSB among S-I bits representing significant digits.
  • the processor 120 sets the bit lower than the upper bit 4 based on the MSB among the mantissa part of 19 bits (or the lower bit based on the LSB of the mantissa part) 15) (5th bit) can be removed.
  • the processor 120 may add a fifth bit as much as a guard bit to the left portion of the remaining upper 4 bits.
  • the processor 120 inputs the second output data 55 and the third output data stored in the buffer (or accumulation buffer) 65 to the fourth module 60 to output the second output data.
  • Fourth output data obtained by adding data and third output data may be obtained.
  • the fourth module 60 may be expressed as a QF (Quantum Floating) Adder module.
  • the fourth module 60 identifies a larger scaling factor among the first unit scaling factor of the second output data 55 and the second unit scaling factor of the third output data, and the identified unit scaling factor having a larger size.
  • a related embodiment will be described in detail with reference to FIGS. 5A and 5B.
  • 5A and 5B are diagrams for explaining a process in which first output data is converted into second output data and a sum operation is performed with third output data stored in a buffer.
  • the processor 120 inputs the third scaling factor 510 and the first output data 515 to the third module 50 to output the second output.
  • data can be obtained.
  • the processor 120 may obtain fourth output data by inputting the second output data and the third output data 507 to the fourth module 60 .
  • the processor 120 determines the size of the first unit scaling factor (or first index scale) of the second output data and the second unit scaling factor 520 of the third output data 507 through the fourth module 60 . may identify a larger unit scaling factor.
  • the processor 120 may align the unit scaling factors of the second output data and the third output data with the larger unit scaling factor (eg, 2) identified through the fourth module 60 .
  • the processor 120 may convert the first unit scaling factor of the second output data from 1 to 2, which is the same as the second unit scaling factor, through the fourth module 60 .
  • the processor 120 may obtain the second output data 505 aligned according to the converted unit scaling factor through the fourth module 60 .
  • the processor 120 aligns the first unit scaling factor to 2 through the fourth module 60, and the remaining bits except for the upper 8 bits based on the MSB of the mantissa part are It can be removed and bit 11 can be added as a guard bit.
  • the processor 120 may obtain fourth output data in which the second output data in which the unit scale is aligned and the third output data are summed through the fourth module 60 .
  • the processor 120 inputs the third scaling factor 540 and the first output data 545 to the third module 50 to input the second output data ( 512) can be obtained.
  • the processor 120 may obtain the fourth output data by inputting the second output data 512 and the third output data 513 to the fourth module 60 .
  • the processor 120 performs a first unit scaling factor (or a first index scale) 560 of the second output data 512 and a second unit scaling of the third output data 513 through the fourth module 60 .
  • a unit scaling factor having a larger size may be identified. Since the first scaling factor 540 of the first output data is converted into a first unit scaling factor (eg, 3), the first unit scaling factor is greater than the second unit scaling factor (eg, 2).
  • the processor 120 may align the unit scaling factors of the second output data and the third output data with the larger unit scaling factor (eg, 3) identified through the fourth module 60 .
  • the processor 120 may convert the second unit scale factor of the third output data from 2 to 3, which is the same as the first unit scale, through the fourth module 60 .
  • the processor 120 may obtain the third output data 514 in which the unit scale factors are aligned based on the unit scale factors converted through the fourth module 60 .
  • the processor 120 may obtain fourth output data in which the second output data in which the unit scale is aligned and the third output data are summed through the fourth module 60 .
  • the processor 120 may normalize the obtained fourth output data to be converted into a floating point form representing the first bit in a unit scale, and store the normalized data in the buffer 65 .
  • the control may be performed to be stored in the buffer 65 .
  • the register means a space for temporarily maintaining or storing various instructions executed by the processor 120 and data that is a target of the instruction.
  • the processor 120 when overflow occurs while summing the second output data and the third output data, the processor 120 increases the index scale by 1 (eg, 3 to 4) can be made. In addition, the processor 120 may remove the lower bit 8 from bit 11 of the mantissa part based on the LSB.
  • the processor 120 may determine whether to decrease the index scale factor by detecting 0 or 1 in block units.
  • the fourth output data 630 is a positive number.
  • the processor 120 may maintain the index scale.
  • the processor 120 may decrease the index scale by 1.
  • the processor 120 may decrease the index scale by 2.
  • the processor 120 may identify the fourth output data as 0 if 1 is not detected even in the third block 640 .
  • the processor 120 may adjust the index scale based on whether the first 1 is detected in the first block 650 of the fourth output data 630 . For example, assuming that the fourth output data 630 is a positive number, if the first 1 is not detected in the first block 650 , the processor 120 lowers the index scale by 1, and the first block 650 . When the first 1 is detected in , the processor 120 may maintain the index scale. Meanwhile, when the fourth output data 630 is a negative number, the processor 120 may adjust the index scale based on whether the first 0 is detected in the first block 650 of the fourth output data 630 .
  • the electronic device 100 may reduce the size of the area occupied by the module performing the normalization operation by performing a normalization operation using only the first block of the fourth output data 630 .
  • the processor 120 may reduce the number of bits by converting the first output data into a quantum floating-point format.
  • the processor 120 may reduce the word size of the buffer by storing the fourth output data obtained by performing an addition operation between the data having the reduced number of bits in the buffer.
  • the processor 120 variably removes bits of data and performs an addition operation based on the data converted to the quantum floating point form, thereby reducing the size of the area occupied by each module and reducing power consumption. .
  • the electronic device 100 includes a memory 110 , a processor 120 , a display 130 , an input unit 140 , a communication unit 150 , a speaker 160 , and a microphone 170 . can do. Since the descriptions of the memory 110 and the processor 120 have been described above, overlapping descriptions will be omitted.
  • the display 130 may display various information under the control of the processor 120 .
  • the display 130 may display the first input data or display the fourth output data obtained by performing an operation between the weight data and the input data.
  • displaying the fourth output data may include displaying a screen including text or an image generated based on the fourth output data. That is, the display 130 may display a result output through the neural network model.
  • the display 130 may include a Liquid Crystal Display (LCD), Organic Light Emitting Diodes (OLED), Active-Matrix Organic Light-Emitting Diode (AM-OLED), Liquid Crystal on Silicon (LcoS) or Digital Light Processing (DLP), etc. It can be implemented with various display technologies. Also, the display 130 may be coupled to at least one of a front area, a side area, and a rear area of the electronic device 100 in the form of a flexible display.
  • LCD Liquid Crystal Display
  • OLED Organic Light Emitting Diodes
  • AM-OLED Active-Matrix Organic Light-Emitting Diode
  • LcoS Liquid Crystal on Silicon
  • DLP Digital Light Processing
  • the input unit 140 includes a circuit and may receive a user input for controlling the electronic device 100 .
  • the input unit 140 may include a touch panel for receiving a user touch input using a user's hand or a stylus pen, a button for receiving a user manipulation, and the like.
  • the input unit 140 may be implemented as another input device (eg, a keyboard, a mouse, a motion input unit, etc.). Meanwhile, the input unit 140 may receive first input data input from the user or receive various user commands.
  • the communication unit 150 includes a circuit and may communicate with an external device.
  • the communication connection of the communication unit 150 with the external device may include communicating through a third device (eg, a repeater, a hub, an access point, a server, or a gateway, etc.).
  • the communication unit 150 may include various communication modules to communicate with an external device.
  • the communication unit 150 may include a wireless communication module, for example, 5G (5TH Generation), LTE (Long-Term Evolution), LTE-A (LTE-Advance), CDMA (code division multiple access) ), a cellular communication module using at least one of wideband CDMA (WCDMA), and the like.
  • 5G 5TH Generation
  • LTE Long-Term Evolution
  • LTE-A LTE-Advance
  • CDMA code division multiple access
  • WCDMA wideband CDMA
  • the wireless communication module may include, for example, at least one of wireless fidelity (WiFi), Bluetooth, Bluetooth low energy (BLE), Zigbee, radio frequency (RF), or body area network (BAN).
  • WiFi wireless fidelity
  • BLE Bluetooth low energy
  • RF radio frequency
  • BAN body area network
  • the communication unit 150 may receive various types of first input data from an external device communicatively connected to the electronic device 100 .
  • the communication unit 150 may include various types of first input data from an input device (eg, a camera, a microphone, a keyboard, etc.) wirelessly connected to the electronic device 100 or an external server capable of providing various contents. can receive an input device (eg, a camera, a microphone, a keyboard, etc.) wirelessly connected to the electronic device 100 or an external server capable of providing various contents. can receive an input device (eg, a camera, a microphone, a keyboard, etc.) wirelessly connected to the electronic device 100 or an external server capable of providing various contents. can receive an input device (eg, a camera, a microphone, a keyboard, etc.) wirelessly connected to the electronic device 100 or an external server capable of providing various contents. can receive an input device (eg, a camera, a microphone, a keyboard, etc.) wirelessly connected to the electronic device 100 or an external server capable of providing various contents. can receive an
  • the speaker 160 is configured to output various audio data on which various processing operations such as decoding, amplification, and noise filtering have been performed by an audio processing unit (not shown). In addition, the speaker 160 may output various notification sounds or voice messages.
  • the speaker 160 sounds a notification sound indicating that an operation result between the weight data and the input data (eg, the fourth output data or a text or image generated based on the fourth output data) is obtained by the neural network model. can be printed out.
  • the microphone 170 is configured to receive a voice input from a user.
  • the microphone 170 may be provided inside the electronic device 100 , but may be provided outside and electrically connected to the electronic device 100 .
  • the microphone 170 may transmit a user voice signal generated through a wired/wireless interface (eg, Wi-Fi, Bluetooth) to the processor 120 .
  • a wired/wireless interface eg, Wi-Fi, Bluetooth
  • the microphone 170 may receive a user voice including a wake-up word (or trigger word) capable of activating an artificial intelligence model composed of various artificial neural networks.
  • a wake-up word or trigger word
  • the processor 120 may activate the artificial intelligence model and use the user's voice as first input data to perform an operation between weight data.
  • the processor 120 may include one or a plurality of processors.
  • one or more processors are general-purpose processors such as CPUs, application processors (APs), digital signal processors (DSPs), etc., graphics-only processors such as GPUs and VPUs (Vision Processing Units), or artificial processing units such as Neural Processing Units (NPUs). It may be an intelligence-only processor.
  • One or a plurality of processors 120 controls to process input data according to a predefined operation rule or artificial intelligence model stored in the memory 110 .
  • the AI-only processor may be designed with a hardware structure specialized for processing a specific AI model.
  • a predefined action rule or artificial intelligence model is characterized in that it is created through learning.
  • being made through learning means that a basic artificial intelligence model is learned using a plurality of learning data by a learning algorithm, so that a predefined action rule or artificial intelligence model set to perform a desired characteristic (or purpose) is created It can mean burden.
  • Such learning may be performed in the device itself on which artificial intelligence according to the present disclosure is performed, or may be performed through a separate server and/or system.
  • Examples of the learning algorithm include, but are not limited to, supervised learning, unsupervised learning, semi-supervised learning, or reinforcement learning.
  • the artificial intelligence model includes a plurality of artificial neural networks, and the artificial neural network may be composed of a plurality of layers.
  • Each of the plurality of neural network layers has a plurality of weight values, and a neural network operation is performed through an operation between the operation result of a previous layer and the plurality of weights.
  • the plurality of weights of the plurality of neural network layers may be optimized by the learning result of the artificial intelligence model. For example, a plurality of weights may be updated so that a loss value or a cost value obtained from the artificial intelligence model during the learning process is reduced or minimized.
  • artificial neural networks include Convolutional Neural Network (CNN), Deep Neural Network (DNN), Recurrent Neural Network (RNN), Restricted Boltzmann Machine (RBM), Deep Belief Network (DBN), Bidirectional Recurrent Deep Neural Network (BRDNN) and Deep Q-Networks, and the like, and the artificial neural network in the present disclosure is not limited to the above-described example, except as otherwise specified.
  • FIG. 8 is a flowchart illustrating a method of controlling the electronic device 100 according to an embodiment of the present disclosure.
  • the electronic device 100 inputs each of the first input data and the first weight data to the first module, and the second input data from which a part of the first input data is removed and the second weight data from which the part of the first weight data is removed. Each can be obtained (S810).
  • the electronic device 100 identifies the most significant bit including a valid value among upper second bits based on the MSB of the input data, and based on the LSB of the input data based on the identified most significant bit
  • the second input data and the second weight data may be obtained by using a first module that identifies a scaling factor indicating a low-order bit to be removed and removes some of the input data based on the scaling factor.
  • the electronic device 100 identifies, through the first module, a first most significant bit including a valid value among the second bits of the first input data, and is located higher than the first most significant bit among the second bits.
  • the third bit may be identified, and a difference between the second bit and the third bit may be identified as a first scaling factor corresponding to the first input data.
  • the electronic device 100 identifies, through the first module, the second most significant bit including the effective value among the second bits of the first weight data, and places the second most significant bit higher than the second most significant bit among the second bits.
  • the positioned fourth bit may be identified, and a difference between the second bit and the fourth bit may be identified as a second scaling factor corresponding to the first weight data.
  • the electronic device 100 may obtain second input data by removing data corresponding to the third bit and data corresponding to the first scaling factor among the first input data through the first module.
  • the electronic device 100 may obtain the second weight data by removing data corresponding to the fourth bit and data corresponding to the second scale factor among the first weight data through the first module. .
  • the electronic device 100 may obtain the first output data by inputting the second input data and the second weight data to a second module that performs a multiplication operation (S820).
  • the electronic device 100 based on the scaling factors of the first input data and the first weight data identified through the first module, is a floating-point type representing the first bit with respect to the obtained first output data in a unit scale , to obtain second output data (S830).
  • the electronic device 100 may acquire the third scaling factor by summing the scaling factors of each of the first input data and the first weight data identified through the first module. Then, the electronic device 100 may obtain the second output data by inputting the third scale value and the first output data to the third module.
  • the third module converts the third scaling factor into a unit scale form, removes a lower fifth bit based on the LSB of the first output data based on the converted unit scale form, and increases the guard bit by the removed fifth bit.
  • it is a module that outputs second output data.
  • the electronic device 100 may obtain the fourth output data obtained by adding the second output data and the third output data by inputting the second output data and the third output data previously stored in the buffer to the fourth module.
  • the electronic device 100 may normalize the fourth output data to be converted into a floating point form representing the first bit on a unit scale, and store the normalized data in a buffer.
  • various embodiments of the present disclosure described above may be performed through an embedded server provided in an electronic device or an external server of at least one of an electronic device and a display device.
  • the various embodiments described above may be implemented as software including instructions stored in a machine-readable storage media readable by a machine (eg, a computer).
  • the device is a device capable of calling a stored command from a storage medium and operating according to the called command, and may include the electronic device according to the disclosed embodiments.
  • the processor may perform a function corresponding to the instruction by using other components directly or under the control of the processor.
  • the device-readable storage medium may be provided in the form of a non-transitory storage medium.
  • the 'non-transitory storage medium' does not include a signal and only means that it is tangible and does not distinguish that data is semi-permanently or temporarily stored in the storage medium.
  • the 'non-transitory storage medium' may include a buffer in which data is temporarily stored.
  • the method according to the various embodiments described above may be included in a computer program product and provided.
  • Computer program products may be traded between sellers and buyers as commodities.
  • the computer program product may be distributed in the form of a machine-readable storage medium (eg, compact disc read only memory (CD-ROM)) or online through an application store (eg, Play StoreTM).
  • an application store eg, Play StoreTM
  • at least a portion of the computer program product may be temporarily stored or temporarily generated in a storage medium such as a memory of a server of a manufacturer, a server of an application store, or a relay server.
  • each of the components may be composed of a single or a plurality of entities, and some sub-components of the aforementioned sub-components may be omitted, or other sub-components may be omitted. Components may be further included in various embodiments.
  • some components eg, a module or a program
  • operations performed by a module, program, or other component may be sequentially, parallelly, repetitively or heuristically executed, or at least some operations may be executed in a different order, omitted, or other operations may be added.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computing Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Biophysics (AREA)
  • Molecular Biology (AREA)
  • Biomedical Technology (AREA)
  • Computational Linguistics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Image Processing (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

전자 장치 및 이의 제어 방법이 개시된다. 본 개시의 전자 장치는 제1 입력 데이터 및 신경망 모델의 연산에 이용되는 제1 가중치 데이터를 저장하는 메모리 및 제1 입력 데이터와 제1 가중치 데이터를 제1 모듈에 입력하여 제1 입력 데이터 중 일부가 제거된 제2 입력 데이터 및 제1 가중치 데이터 중 일부가 제거된 제2 가중치 데이터를 획득하고, 제2 입력 데이터 및 제2 가중치 데이터를 곱 연산을 수행하는 제2 모듈에 입력하여 제1 출력 데이터를 획득하고, 제1 모듈을 통해 식별된 제1 입력 데이터 및 제1 가중치 데이터의 스케일링 인자에 기초하여, 획득된 제1 출력 데이터에 대해 제1 비트를 단위 스케일로 나타내는 부동 소수점 형태로 변환하여 제2 출력 데이터를 획득하는 프로세서를 포함할 수 있다.

Description

전자 장치 및 이의 제어 방법
본 개시는 전자 장치 및 이의 제어 방법에 관한 것으로서, 더욱 상세하게는 인공 지능 모델 상에서 가중치 및 입력 데이터에 대한 연산을 효율적으로 수행하는 전자 장치 및 이의 제어 방법에 관한 것이다.
CROSS-REFERENCE TO RELATED APPLICATIONS
본 출원은 2020년 11월 9일에 출원된 대한민국 특허출원 제 10-2020-0148619 호에 기초하여 우선권을 주장하며, 해당 출원의 모든 내용은 그 전체가 본 출원에 레퍼런스로 포함된다.
근래에는 인공 지능 시스템을 활용한 음성 인식 시스템이 다양한 분야에서 이용되고 있다. 인공 지능 시스템은 기존의 룰(rule) 기반 스마트 시스템과 달리 기계가 스스로 학습시키고 판단하며 똑똑해지는 시스템이다. 인공 지능 시스템은 사용할수록 인식률이 향상되고 사용자 취향을 보다 정확하게 이해할 수 있게 되어, 기존 룰 기반 스마트 시스템은 점차 딥러닝 기반 인공 지능 시스템으로 대체되고 있다.
인공 지능 기술은 기계 학습(예로, 딥 러닝) 알고리즘을 활용하여 각종 인지, 판단 기능을 수행하는 기술을 포함하며, 기계학습 알고리즘은 입력 데이터들의 특징을 스스로 분류/학습시키는 알고리즘 기술을 의미할 수 있다.
기계 학습 알고리즘의 정확도를 높이기 위해 더 많은 연산을 요구하게 되어 기계 학습 가속기에 점차 많은 수의 MAC(Multiply-Accumulate)연산기가 집적되었다. 이에 따라, 가속기에 MAC 연산을 수행하기 위한 로직이 차지하는 면적이 점차 커지는 한계가 존재하였다.
또한, 기존에는, 기계 학습 알고리즘의 정확도를 높이기 위해 다양한 부동 소수점 방식의 수 체계(예를 들어, FP64, FP32 등)를 활용하였으나, 위 수 체계를 활용하기 위하여 연산기가 차지하는 면적 및 연산을 수행하기 위한 전력 소모가 크다는 한계가 존재하였다.
본 개시는 상술한 문제점을 해결하기 위해 안출된 것으로서, 본 개시의 목적은 인공 지능 기술에 기반하여 가중치 데이터와 입력 데이터 간의 연산을 수행하는 전자 장치 및 이의 제어 방법에 관한 것이다.
본 개시의 일 실시예로, 전자 장치는 제1 입력 데이터 및 신경망 모델의 연산에 이용되는 제1 가중치 데이터를 저장하는 메모리 및 상기 제1 입력 데이터 및 상기 제1 가중치 데이터를 제1 모듈에 입력하여 상기 제1 입력 데이터 중 일부가 제거(truncation)된 제2 입력 데이터 및 상기 제1 가중치 데이터 중 일부가 제거된 제2 가중치 데이터를 획득하고, 상기 제2 입력 데이터 및 상기 제2 가중치 데이터를 곱 연산을 수행하는 제2 모듈에 입력하여 제1 출력 데이터를 획득하고, 상기 제1 모듈을 통해 식별된 상기 제1 입력 데이터 및 상기 제1 가중치 데이터의 스케일링 인자(scaling factor)에 기초하여, 상기 획득된 제1 출력 데이터에 대해 제1 비트를 단위 스케일로 나타내는 부동 소수점(floating point) 형태로 변환하여 제2 출력 데이터를 획득하는 프로세서를 포함할 수 있다.
본 개시의 또 다른 실시예로, 제1 입력 데이터 및 신경망 모델의 연산에 이용되는 제1 가중치 데이터를 저장하는 메모리를 포함하는 전자 장치의 제어 방법은 제1 입력 데이터 및 제1 가중치 데이터를 제1 모듈에 입력하여 상기 제1 입력 데이터 중 일부가 제거(truncation)된 제2 입력 데이터 및 상기 제1 가중치 데이터 중 일부가 제거된 제2 가중치 데이터를 획득하는 단계, 상기 제2 입력 데이터 및 상기 제2 가중치 데이터를 곱 연산을 수행하는 제2 모듈에 입력하여 제1 출력 데이터를 획득하는 단계 및 상기 제1 모듈을 통해 식별된 상기 제1 입력 데이터 및 상기 제1 가중치 데이터의 스케일링 인자에 기초하여, 상기 획득된 제1 출력 데이터에 대해 제1 비트를 단위 스케일로 나타내는 부동 소수점 형태로 변환하여 제2 출력 데이터를 획득하는 단계를 포함할 수 있다.
상술한 바와 같이 본 개시의 다양한 실시예에 의해, 전자 장치는 제한된 리소스를 포함하는 단말 장치 상에서도 가중치 값과 입력 데이터 간에 연산을 효율적으로 수행할 수 있다.
도 1은 본 개시의 일 실시예에 따른, 전자 장치의 구성을 간략히 도시한 블록도이다.
도 2는 본 개시의 일 실시예에 따른, 전자 장치가 입력 데이터 및 가중치 데이터 간에 연산을 수행하는 구조 및 동작을 설명하기 위한 도면이다.
도 3a 및 도 3b는 본 개시의 일 실시예에 따른, 전자 장치가 입력 데이터 및 가중치 데이터 중 일부를 제거하는 과정을 설명하기 위한 도면이다.
도 4는 본 개시의 일 실시예에 따른, 제1 비트를 단위 스케일로 나타내는 부동 소수점 형태에 대해 설명하기 위한 도면이다.
도 5a 및 도 5b는 본 개시의 일 실시예에 따른, 전자 장치가 출력 데이터 간에 가산하는 동작을 설명하기 위한 도면이다.
도 6a 및 도 6b는 본 개시의 일 실시예에 따른, 전자 장치가 출력 데이터에 대해 정규화하는 동작을 설명하기 위한 도면이다.
도 7은 본 개시의 일 실시예에 따른, 전자 장치의 구성을 상세히 도시한 블록도이다.
도 8은 본 개시의 일 실시예에 따른, 전자 장치의 제어 방법을 설명하기 위한 순서도이다.
본 개시의 실시 예들은 다양한 변환을 가할 수 있고 여러 가지 실시 예를 가질 수 있는바, 특정 실시 예들을 도면에 예시하고 상세한 설명에 상세하게 설명하고자 한다. 그러나 이는 특정한 실시 형태에 대해 범위를 한정하려는 것이 아니며, 본 개시의 실시 예의 다양한 변경(modifications), 균등물(equivalents), 및/또는 대체물(alternatives)을 포함하는 것으로 이해되어야 한다. 도면의 설명과 관련하여, 유사한 구성요소에 대해서는 유사한 참조 부호가 사용될 수 있다.
본 개시를 설명함에 있어서, 관련된 공지 기능 혹은 구성에 대한 구체적인 설명이 본 개시의 요지를 불필요하게 흐릴 수 있다고 판단되는 경우 그에 대한 상세한 설명은 생략한다.
덧붙여, 하기 실시 예는 여러 가지 다른 형태로 변형될 수 있으며, 본 개시의 기술적 사상의 범위가 하기 실시 예에 한정되는 것은 아니다. 오히려, 이들 실시 예는 본 개시를 더욱 충실하고 완전하게 하고, 해당 기술 분야의 통상의 기술자에게 본 개시의 기술적 사상을 완전하게 전달하기 위하여 제공되는 것이다.
본 개시에서 사용한 용어는 단지 특정한 실시 예를 설명하기 위해 사용된 것으로, 권리범위를 한정하려는 의도가 아니다. 단수의 표현은 문맥상 명백하게 다르게 뜻하지 않는 한, 복수의 표현을 포함한다.
본 개시에서, "가진다," "가질 수 있다," "포함한다," 또는 "포함할 수 있다" 등의 표현은 해당 특징(예: 수치, 기능, 동작, 또는 부품 등의 구성요소)의 존재를 가리키며, 추가적인 특징의 존재를 배제하지 않는다.
본 개시에서, "A 또는 B," "A 또는/및 B 중 적어도 하나," 또는 "A 또는/및 B 중 하나 또는 그 이상"등의 표현은 함께 나열된 항목들의 모든 가능한 조합을 포함할 수 있다. 예를 들면, "A 또는 B," "A 및 B 중 적어도 하나," 또는 "A 또는 B 중 적어도 하나"는, (1) 적어도 하나의 A를 포함, (2) 적어도 하나의 B를 포함, 또는 (3) 적어도 하나의 A 및 적어도 하나의 B 모두를 포함하는 경우를 모두 지칭할 수 있다.
본 개시에서 사용된 "제1," "제2," "첫째," 또는 "둘째,"등의 표현들은 다양한 구성요소들을, 순서 및/또는 중요도에 상관없이 수식할 수 있고, 한 구성요소를 다른 구성요소와 구분하기 위해 사용될 뿐 해당 구성요소들을 한정하지 않는다.
어떤 구성요소(예: 제1 구성요소)가 다른 구성요소(예: 제2 구성요소)에 "(기능적으로 또는 통신적으로) 연결되어((operatively or communicatively) coupled with/to)" 있다거나 "접속되어(connected to)" 있다고 언급된 때에는, 상기 어떤 구성요소가 상기 다른 구성요소에 직접적으로 연결되거나, 다른 구성요소(예: 제3 구성요소)를 통하여 연결될 수 있다고 이해되어야 할 것이다.
반면에, 어떤 구성요소(예: 제1 구성요소)가 다른 구성요소(예: 제2 구성요소)에 "직접 연결되어" 있다거나 "직접 접속되어" 있다고 언급된 때에는, 상기 어떤 구성요소와 상기 다른 구성요소 사이에 다른 구성요소(예: 제3 구성요소)가 존재하지 않는 것으로 이해될 수 있다.
본 개시에서 사용된 표현 "~하도록 구성된(또는 설정된)(configured to)"은 상황에 따라, 예를 들면, "~에 적합한(suitable for)," "~하는 능력을 가지는(having the capacity to)," "~하도록 설계된(designed to)," "~하도록 변경된(adapted to)," "~하도록 만들어진(made to)," 또는 "~를 할 수 있는(capable of)"과 바꾸어 사용될 수 있다. 용어 "~하도록 구성된(또는 설정된)"은 하드웨어적으로 "특별히 설계된(specifically designed to)" 것만을 반드시 의미하지 않을 수 있다.
대신, 어떤 상황에서는, "~하도록 구성된 장치"라는 표현은, 그 장치가 다른 장치 또는 부품들과 함께 "~할 수 있는" 것을 의미할 수 있다. 예를 들면, 문구 "A, B, 및 C를 수행하도록 구성된(또는 설정된) 프로세서"는 해당 동작을 수행하기 위한 전용 프로세서(예: 임베디드 프로세서), 또는 메모리 장치에 저장된 하나 이상의 소프트웨어 프로그램들을 실행함으로써, 해당 동작들을 수행할 수 있는 범용 프로세서(generic-purpose processor)(예: central processing unit(CPU) 또는 application processor)를 의미할 수 있다.
실시 예에 있어서 '모듈' 혹은 '부'는 적어도 하나의 기능이나 동작을 수행하며, 하드웨어 또는 소프트웨어로 구현되거나 하드웨어와 소프트웨어의 결합으로 구현될 수 있다. 또한, 복수의 '모듈' 혹은 복수의 '부'는 특정한 하드웨어로 구현될 필요가 있는 '모듈' 혹은 '부'를 제외하고는 적어도 하나의 모듈로 일체화되어 적어도 하나의 프로세서로 구현될 수 있다.
한편, 도면에서의 다양한 요소와 영역은 개략적으로 그려진 것이다. 따라서, 본 발명의 기술적 사상은 첨부한 도면에 그려진 상대적인 크기나 간격에 의해 제한되지 않는다.
본 개시는 입력 데이터 및 가중치 데이터 각각에 대해 가변 비트(adaptive Bit)를 제거(truncation)하여 입력 데이터와 가중치 데이터 간의 곱 연산을 수행하는 로직이 포함된 모듈의 크기를 감소시키고, 곱 연산 수행 결과 값을 제1 비트를 단위 스케일로 나타내는 부동 소수점 형태로 변환하여 결과 값을 저장하는 버퍼의 워드 사이즈(word size)를 감소시키는 전자 장치 및 이의 제어 방법에 관한 것이다.
이하에서는 도면을 참조하여 본 개시에 대해 구체적으로 설명하도록 한다.
도 1은 본 개시의 일 실시예에 따른, 전자 장치(100)의 구성은 간략히 도시한 블록도이다. 도 1에 도시된 바와 같이, 전자 장치(100)는 메모리(110) 및 프로세서(120)를 포함할 수 있다. 다만, 도 1에 도시된 구성은 본 개시의 실시 예들을 구현하기 위한 예시도이며, 통상의 기술자에게 자명한 수준의 적절한 하드웨어 및 소프트웨어 구성들이 전자 장치(100)에 추가로 포함될 수 있다.
한편, 본 개시를 설명함에 있어서, 전자 장치(100)는 신경망 모델(neural network model)(또는, 인공 지능 모델)의 학습, 압축 또는 신경망 모델을 이용하여 입력 데이터에 대한 출력 데이터를 획득하는 장치로써, 예를 들어, 전자 장치(100)는 데스크탑 PC, 노트북, 스마트 폰, 태블릿 PC, 서버 등으로 구현될 수 있다.
또한, 전자 장치(100)가 수행하는 각종 동작은 클라우딩 컴퓨팅 환경이 구축된 시스템에 의해 수행될 수 있다. 예를 들어, 클라우딩 컴퓨팅 환경이 구축된 시스템은 신경망 모델에 포함된 가중치를 양자화하고, 양자화된 데이터와 입력 데이터 간의 연산을 수행할 수 있다.
메모리(110)는 전자 장치(100)의 적어도 하나의 다른 구성요소에 관계된 명령 또는 데이터를 저장할 수 있다. 그리고, 메모리(110)는 프로세서(120)에 의해 액세스되며, 프로세서(120)에 의한 데이터의 독취/기록/수정/삭제/갱신 등이 수행될 수 있다.
본 개시에서 메모리라는 용어는 메모리(110), 프로세서(120) 내 롬(미도시), 램(미도시) 또는 전자 장치(100)에 장착되는 메모리 카드(미도시)(예를 들어, micro secure digital(SD) 카드, 메모리 스틱)를 포함할 수 있다. 또한, 메모리(110)에는 디스플레이의 디스플레이 영역에 표시될 각종 화면을 구성하기 위한 프로그램 및 데이터 등이 저장될 수 있다.
그리고, 메모리(110)는 전력 공급이 중단되더라도 저장된 정보를 유지할 수 있는 비휘발성 메모리 저장된 정보를 유지하기 위해서는 지속적인 전력 공급이 필요한 휘발성 메모리를 포함할 수 있다. 예로, 비휘발성 메모리는 OTPROM(one time programmable ROM), PROM(programmable ROM), EPROM(erasable and programmable ROM), EEPROM(electrically erasable and programmable ROM), mask ROM, flash ROM 중 적어도 하나로 구현 될 수 있고, 휘발성 메모리는 DRAM(dynamic RAM), SRAM(static RAM), 또는 SDRAM(synchronous dynamic RAM) 중 적어도 하나로 구현될 수 있다. 휘발성 메모리는 프로세서(120)의 일 구성 요소로서 프로세서(120)에 포함된 형태로 구현될 수 있으나, 이는 일 실시예에 불과하며, 휘발성 메모리는 프로세서(120)와 별개의 구성 요소로 구현될 수 있다.
메모리(110)는 신경망 모델의 연산에 이용되는 가중치 데이터를 저장할 수 있다. 즉, 메모리(110)는 신경망 모델을 구성하는 복수의 레이어에 포함된 복수의 가중치 데이터를 저장할 수 있다. 가중치 데이터는 가중치 데이터에 포함된 복수의 가중치 값들을 포함할 수 있다. 가중치 데이터는 정수(Integer) 기반으로 구현된 데이터일 수 있으며, 벡터, 행렬 또는 텐서(tensor) 중 적어도 하나를 통해 표현될 수 있다.
메모리(110)는 다양한 유형의 입력 데이터를 저장할 수 있다. 예를 들면, 메모리(110)는 마이크를 통해 입력된 음성 데이터, 입력부(예를 들어, 카메라, 키보드 등)를 통해 입력된 이미지 데이터 또는 텍스트 데이터 등을 저장할 수 있다. 메모리(110)에 저장된 입력 데이터는 외부 장치를 통해 수신된 데이터가 포함될 수 있다.
가중치 데이터 및 입력 데이터 각각은 부호(sign) 데이터를 포함할 수 있다. 부호 데이터는 각 데이터의 크기는 변경하지 않고 부호만을 나타내는 값을 포함하는 데이터를 의미할 수 있다. 특정 데이터가 양수인 경우 부호 데이터는 0으로 구현되고, 특정 데이터가 음수인 경우 부호 데이터는 1로 구현될 수 있다. 다만, 이에 국한되는 것은 아니며 각 데이터의 부호는 다양한 방식으로 표현될 수 있다.
메모리(110)는 제1 모듈, 제2 모듈, 제3 모듈 및 제4 모듈이 각종 동작을 수행하기 위해 필요한 데이터를 저장할 수 있다. 제1 모듈, 제2 모듈, 제3 모듈 및 제4 모듈이 각종 동작을 수행하기 위해 필요한 데이터는 비휘발성 메모리에 저장되어 있을 수 있다. 각 모듈에 대한 설명은 후술하는 부분에서 설명하도록 한다.
메모리(110)는 제1 비트를 단위 스케일로 나타내는 부동 소수점 형태로 변환된 출력 데이터를 저장하는 버퍼(buffer)(또는, 누적 버퍼(accumulation buffer))가 포함될 수 있다.
프로세서(120)는 메모리(110)와 전기적으로 연결되어 전자 장치(100)의 전반적인 동작 및 기능을 제어할 수 있다. 프로세서(120)는 전자 장치(100)의 동작을 제어하기 위해 하나 또는 복수의 프로세서를 포함할 수 있다.
프로세서(120)는 제1 모듈, 제2 모듈, 제3 모듈 및 제4 모듈이 각종 동작을 수행하기 위해 필요한 데이터를 비휘발성 메모리에서 휘발성 메모리로 로딩(loading)할 수 있다. 로딩이란 프로세서(120)가 액세스할 수 있도록 비휘발성 메모리에 저장된 데이터를 휘발성 메모리에 불러들여 저장하는 동작을 의미한다.
프로세서(120)는 각 모듈을 이용하여 입력 데이터와 제1 가중치 데이터 간의 연산 동작을 수행할 수 있다. 프로세서(120)의 각 동작은 도 2 내지 도 6b를 참조하여 구체적으로 설명하도록 한다.
도 2에 도시된 바와 같이, 프로세서(120)는 제1 입력 데이터(10-1) 및 제1 가중치 데이터(10-2)를 제1 모듈(20)에 입력하여 제1 입력 데이터 중 일부가 제거(truncation)된 제2 입력 데이터(35-1) 및 제2 가중치 데이터(35-2)를 획득할 수 있다.
도 2에는 제1 모듈(20)에 제1 입력 데이터(10-1) 및 제1 가중치 데이터(10-2) 모두가 입력되는 하나의 모듈로 구현되어 있으나 이는 일 실시예에 불과하다. 제1 모듈(20)은 제1 입력 데이터(10-1)를 이용하여 제2 입력 데이터(35-1)를 출력하는 모듈 및 입력된 제1 가중치 데이터(10-2)를 이용하여 제2 가중치 데이터(35-2)를 출력하는 모듈로 구분될 수 있다. 즉, 제1 모듈(20)은 제1 입력 데이터(10-1) 및 제1 가중치 데이터(10-2) 각각이 입력되는 별개의 모듈로 구분될 수 있다. 제1 모듈(20)은 가변 제거 모듈(Adaptive Truncation Module)이라고 표현될 수 있다.
한편, 제1 모듈(20)은 입력된 데이터의 부호 데이터를 제외하고 MSB(Most Significant Bit)를 기준으로 상위 제2 비트(bit) 중 유효 값이 포함된 최상위 비트를 식별하고, 식별된 최상위 비트에 기초하여 입력된 데이터(예를 들어, 제1 입력 데이터 및/또는 제1 가중치 데이터)의 LSB(Least Significant Bit)를 기준으로 제거될 하위 비트를 나타내는 스케일링 인자를 식별하고, 식별된 스케일링 인자에 기초하여 입력된 데이터 중 일부를 제거하는 동작을 수행할 수 있다.
예를 들면, 도 3a를 참조할 때, 제1 모듈(20)은 입력된 데이터(300)의 MSB(302)를 기준으로 상위 제2 비트 중 유효 값이 포함된 최상위 bit를 식별할 수 있다. 이 때, 입력된 데이터(300)의 MSB(302)는 부호 데이터(301)를 제외하고 최상위 비트를 의미할 수 있다. 그리고, 입력된 데이터(300)는 제1 입력 데이터(10-1) 또는 제1 가중치 데이터(10-2) 중 하나일 수 있다.
일 실시예로, 입력된 데이터(300)의 부호 데이터(301)가 0이므로, 제1 모듈(20)은 입력된 데이터(300)가 양수임을 식별할 수 있다. 그리고, 제1 모듈(20)은 MSB(302)를 기준으로 상위 제2 비트(예를 들어, 6 bit) 중 유효 값이 포함된 최상위 비트를 식별할 수 있다. 입력된 데이터(300)가 양수이므로 유효 값은 1일 수 있다. 즉, 제1 모듈(20)은 MSB를 기준으로 상위 제2 비트 중 1이 포함된 최상위 비트(leading 1)를 검출(detect)할 수 있다.
또 다른 실시예로, 도 3b를 참조할 때, 입력된 데이터(320)의 부호 데이터(301)가 1이므로, 제1 모듈(20)은 입력된 데이터(320)가 음수임을 식별할 수 있다. 그리고, 제1 모듈(20)은 MSB(322)를 기준으로 상위 제2 비트(예를 들어, 6 bit) 중 유효 값이 포함된 최상위 비트를 식별할 수 있다. 입력된 데이터(320)가 음수이므로 유효 값은 0일 수 있다. 즉, 제1 모듈(20)은 MSB를 기준으로 상위 제2 비트 중 0이 포함된 최상위 비트(leading 0)를 검출할 수 있다.
프로세서(120)는, 제1 모듈(20)을 통해, 제1 입력 데이터(10-1)의 제2 비트 중 유효 값이 포함된 제1 최상위 비트를 식별하고, 제2 비트 중 제1 최상위 비트보다 상위에 위치한 제3 비트를 식별하고, 제2 비트와 제3 비트 간의 차이를 제1 입력 데이터(10-1)에 대응되는 제1 스케일링 인자(30-1)로 식별할 수 있다. 이 때, 제1 스케일링 인자는 제1 입력 데이터(10-1)의 LSB를 기준으로 제거된 데이터 비트 수를 의미할 수 있다. 예를 들어, 제1 입력 데이터의 LSB를 기준으로 2bit가 제거된 경우, 스케일링 인자는 2이다.
예를 들어, 도 3a에 도시된 바와 같이, 제2 비트가 bit 6인 경우를 가정한다. 프로세서(120)는 제1 모듈(20)을 통해 입력된 16bit인 데이터(예를 들어, 제1 입력 데이터(10-1))(300)의 MSB(302)를 기준으로 상위 bit 6 중 유효 값이 포함된 제1 최상위 비트를 식별할 수 있다. 유효 값이 포함된 제1 최상위 비트(303)가 식별되면, 프로세서(120)는 부호 데이터를 제외하고 제1 최상위 비트(303)보다 상위에 위치한 제3 비트(예를 들어, 부호 데이터(301)와 제1 최상위 비트(303) 사이에 0이 포함된 4bits)를 식별할 수 있다. 프로세서(120)는 제1 모듈(20)을 통해 제2 비트(예로, 6bit)와 제3 비트(4 bit)간의 차이인 2bits에 대응되는 수치인 2를 제1 스케일링 인자로 식별할 수 있다.
또 다른 실시예로, 도 3b에 도시된 바와 같이, 제2 비트가 bit 6인 경우를 가정한다. 프로세서(120)는 제1 모듈(20)을 통해 입력된 16 bit인 데이터(예를 들어, 제1 입력 데이터(10-1))(320)의 MSB(332)를 기준으로 상위 bit 6 중 유효 값이 포함된 제1 최상위 비트를 식별할 수 있다. 유효 값이 포함된 제1 최상위 비트(323)가 식별되면, 프로세서(120)는 부호 데이터를 제외하고 제1 최상위 비트(323)보다 상위에 위치한 제3 비트(예를 들어, 부호 데이터(301)와 제1 최상위 비트(323) 사이에 0이 포함된 3bits)를 식별할 수 있다. 프로세서(120)는 제1 모듈(20)을 통해 제2 비트(예로, bit 6)와 제3 비트(bit 3)간의 차이인 3bit에 대응되는 수치인 3를 제1 스케일링 인자로 식별할 수 있다.
프로세서(120)는 제1 모듈(20)을 통해 제1 입력 데이터(10-1)를 처리하는 방식과 동일하게 제1 가중치 데이터(10-2)를 처리할 수 있다. 프로세서(120)는, 제1 모듈(20)을 통해, 제1 입력 데이터(10-1)의 제2 비트 중 유효 값이 포함된 제2 최상위 비트를 식별하고, 제2 비트 중 제2 최상위 비트보다 상위에 위치한 제4 비트를 식별하고, 제2 비트와 제4 비트 간의 차이를 제1 가중치 데이터(10-2)에 대응되는 제2 스케일링 인자(30-2)로 식별할 수 있다. 이 때, 제2 스케일링 인자는 제1 가중치 데이터(10-2)의 LSB를 기준으로 제거된 데이터 비트 수를 의미할 수 있다.
프로세서(120)는, 제1 모듈(20)을 통해, 제1 입력 데이터(10-1) 중 제3 비트에 대응되는 데이터 및 제1 스케일링 인자에 대응되는 데이터를 제거하여 제2 입력 데이터를 획득할 수 있다. 예를 들어, 도 3a을 참조할 때, 입력된 양수인 데이터(300)가 제1 입력 데이터(10-1)라고 가정한다. 프로세서(120)는 부호 데이터(301)와 제1 최상위 비트(303) 사이에 0을 포함하는 4bit인 제3 비트를 제거하고, 제1 스케일링 인자(예를 들어, 2)에 대응되는 2 bit의 데이터(304,305)를 제거하여 제2 입력 데이터(320)를 획득할 수 있다. 즉, 프로세서(120)는 제1 모듈(20)을 통해 16 bit인 제1 입력 데이터를 10bit인 제2 입력 데이터로 변환할 수 있다.
프로세서(120)는, 제1 모듈(20)을 통해, 제1 가중치 데이터 중 제4 비트에 대응되는 데이터 및 제2 스케일 인자에 대응되는 데이터를 제거하여 제2 가중치 데이터를 획득할 수 있다. 예를 들어, 도 3b을 참조할 때, 입력된 음수인 데이터(320)가 제1 가중치 데이터(10-2)라고 가정한다. 프로세서(120)는 부호 데이터와 제2 최상위 비트(323) 사이에 1을 포함하는 3bit 인 제4 비트를 제거하고, 제2 스케일링 인자(예를 들어, 3)에 대응되는 3bit의 데이터(324,325,326)를 제거하여 제2 가중치 데이터(330)를 획득할 수 있다. 즉, 프로세서(120)는 제1 모듈(20)을 통해 16 bit인 제1 가중치 데이터를 10bit인 제2 가중치 데이터로 변환할 수 있다.
한편, 제2 비트는 실험 또는 연구 등을 통해 기설정된 값일 수 있다. 또 다른 실시예로, 제2 비트는 신경망 모델을 통해 출력될 결과의 유형에 따라 변경될 수 있다. 구체적으로, 프로세서(120)는 신경망 모델을 통해 출력될 연산 결과의 유형을 식별할 수 있다. 프로세서(120)는 식별된 유형의 결과를 출력하기 위해 필요한 연산 정확도를 식별할 수 있다. 그리고, 프로세서(120)는 식별된 연산 정확도가 높을수록 제2 비트의 크기를 제1 값으로 결정하고, 식별된 연산 정확도가 낮을수록 제2 비트의 크기를 제1 값 보다 큰 제2 값으로 결정할 수 있다.
예를 들어, 객체 인식(object recognition) 동작과 같은 분류(classification) 동작을 수행하기 위해 필요한 연산의 정확도는 초 해상화(super-resolution) 동작과 같은 회귀(regression) 동작을 수행하기 위해 필요한 연산의 정확도보다 낮을 수 있다. 이에 따라, 신경망 모델이 분류 동작을 수행하는 경우, 프로세서(120)는 제2 비트의 크기를 8 bit로 결정하고, 신경망 모델이 회귀 동작을 수행하는 경우, 프로세서(120)는 제2 비트의 크기를 4bit로 할 수 있다. 이 때, 제2 비트의 크기로 결정되는 수치는 연구 또는 실험을 통해 산출된 결과일 수 있다.
프로세서(120)는 신경망 모델을 통해 특정 유형의 결과를 출력하기 위해 필요한 연산 정확도에 기초하여 가변적으로 제거할 비트 수를 조절함으로써 연산에 소모되는 전력의 양을 축소시킬 수 있다.
도 2를 참조하면, 프로세서(120)는 제2 입력 데이터(35-1) 및 제2 가중치 데이터(35-2)를 곱 연산을 수행하는 제2 모듈(40)에 입력하여 제1 출력 데이터(45)를 획득할 수 있다. 제2 모듈(40)은 곱(multiply) 연산을 수행하기 위한 로직(logic)이 포함된 하드웨어 모듈로 구현될 수 있으며, 곱 연산 모듈로 표현될 수 있다. 다만, 이는 일 실시예에 불과하며 제2 모듈(40)은 소프트웨어 모듈로 구현될 수도 있다.
기존의 공개된 알고리즘은 일반적으로 머신 러닝 프레임 워크(framework)에서 제공되는 CPU 또는 graphics processing unit(GPU) 기반의 수 체계인 16 bit로 양자화(Quantization)되어 학습된 경우가 많았다. 학습 당시에 사용된 환경(Hyper-parameter)을 정확히 알지 못할 경우, 이러한 알고리즘에 대해 더욱 최적화된 양자화를 수행하는 것은 다소 어렵다는 문제가 발생한다. 따라서, 종래의 하드웨어 가속기는 16bit 기반의 데이터의 연산을 수행하기 위한 연산기 등이 포함되어야 했다. 예를 들어, 입력 데이터(10-1) 및 제1 가중치 데이터(10-2) 각각이 16 bit인 경우, 곱 연산을 수행하기 위한 모듈에는 16bit x 16 bit를 수행하기 위한 로직이 포함되었다. 또한, 곱 연산을 수행하는 모듈의 경우, 곱 연산을 수행할 데이터의 bit수가 증가할 경우, 증가되는 bit의 제곱에 비례하여 면적 복잡도가 증가될 수 있다.
본 개시의 경우, 프로세서(120)가 제1 입력 데이터(10-1) 및 제1 가중치 데이터(10-2) 각각에 대해 가변적으로 비트를 제거함으로써 곱 연산을 수행하는 제2 모듈(20)의 사이즈를 감소시킬 수 있다. 예를 들어, 제1 모듈(10)을 통해 16 bit인 제1 입력 데이터(10-1) 및 제1 가중치 데이터(10-2)가 10bit인 제2 입력 데이터(35-1) 및 제2 가중치 데이터(35-2)로 변환된 경우, 제2 모듈은 10 bit x 10 bit를 수행하기 위한 로직만을 포함하더라도 연산을 수행할 수 있다. 이에 따라, 곱 연산을 수행하는 제2 모듈이 차지하는 면적 및 곱 연산을 수행하기 위해 소모되는 전력은 감소될 수 있다.
프로세서(120)는 제1 모듈(20)을 통해 식별된 제1 입력 데이터(10-1) 및 제1 가중치 데이터(10-2) 각각의 스케일링 인자를 합산하여 제3 스케일링 인자를 획득하고, 제3 스케일 값 및 제1 출력 데이터(45)를 제3 모듈(50)에 입력하여 제2 출력 데이터(55)를 획득할 수 있다. 이 때, 제3 모듈(50)은 스케일 변환 모듈(Scale Transformation Module)로 표현될 수 있다.
구체적으로, 프로세서(120)는 제1 입력 데이터(10-1)에 대응되는 제1 스케일링 인자(30-1)와 제2 입력 데이터(10-2)에 대응되는 제2 스케일링 인자(30-2)를 합산하여 제3 스케일링 인자를 획득할 수 있다. 그리고, 프로세서(120)는, 제3 스케일링 인자에 기초하여, 획득된 제1 출력 데이터에 대해 제1 비트를 단위 스케일로 나타내는 부동 소수점 형태(예로, 퀀텀 부동 소수점(Quantum Floating Point) 형태)로 변환하여 제2 출력 데이터를 획득할 수 있다. 예로, 프로세서(120)는, 제3 모듈(50)을 통해, 제3 스케일링 인자 및 제1 출력 데이터(45)에 기초하여 제2 출력 데이터(55)를 획득할 수 있다.
제3 모듈(50)은 제3 스케일링 인자를 단위 스케일 형태로 변환하고, 변환된 단위 스케일에 기초하여 제1 출력 데이터 중 LSB를 기준으로 하위 제5 비트를 제거하고, 제거된 제5 비트만큼 가드 비트(guard bit)를 부가하여 제2 출력 데이터를 출력하는 모듈이다. 즉, 제3 모듈(50)은 제1 출력 데이터 및 제3 스케일링 인자를 이용하여 제1 출력 데이터를 퀀텀 부동 소수점 형태로 변환하는 모듈이다. 퀀텀 부동 소수점 형태는 도 4를 참조하여 구체적으로 설명하도록 한다.
본 개시의 일 실시예로, 도 4에 도시된 바와 같이, 퀀텀 부동 소수점 형태는 제1 비트(예로, I(I는 정수) bit) 단위로 스케일을 변환(또는, 표현)하고, 가수부는 기존의 고정 소수점과 같은 구조를 가지는 형태를 의미할 수 있다. 인덱스 스케일(425)는 기존 스케일이 제1 비트 단위로 변환된 스케일을 의미할 수 있다.
예로, 정수(Integer) 기반 또는 다른 수 체계 기반으로 표현된 데이터를 퀀텀 부동 소수점 형태로 변환(또는, 표현)하면 400과 같이 표현될 수 있다. 변환된 데이터(400)는 부호 데이터(410)를 위한 1 bit, 인덱스 스케일(425)을 나타내는 E(E는 정수) bit(s), 가수부를 나타내는 S(S는 정수) bit(s)를 포함할 수 있다. 가수부는 오버 플로우(overflow) 발생에 대비하기 위한 I bit인 가드 비트(guard bit)와 유효 숫자 등을 표현하기 위한 S-I bit를 포함할 수 있다.
예를 들면, 제1 비트가 bit 8인 경우를 가정한다. 제1 데이터(450)의 인덱스 스케일이 한 스케일 증가하면, 제1 데이터(450)는 8bit 만큼 스케일이 이동되어 제2 데이터(460)로 변환(또는, 표현)될 수 있다. 또 다른 예로, 제1 데이터(450)의 인덱스 스케일이 한 스케일 감소하면, 제1 데이터(450)는 8bit 만큼 스케일이 이동되어 제2 데이터(460)로 변환(또는, 표현)될 수 있다. 그리고, 예로, 인덱스 스케일을 나타낼 수 있는 E bit가 3 bit이고, 인덱스 스케일이 0~4의 스케일을 가질 수 있는 경우, 정수 기준으로 S+4I+1의 범위를 표현할 수 있다.
일 실시예로, 제1 비트가 8 bit이고, 제3 스케일링 인자가 5인 경우를 가정한다. 프로세서(120)는 제3 모듈(50)를 통해 제3 스케일링 인자(예로, 5)가 제1 비트의 배수 단위로 표현되지 않음을 식별할 수 있다. 이 때, 프로세서(120)는 제3 모듈(50)을 통해 제3 스케일링 인자 값보다 크고 제1 비트의 배수 단위로 표현할 수 있는 수 중 최소 숫자(예로, 8)를 식별할 수 있다. 이 때, 한 단위 스케일이 8 bit이므로, 식별된 최소 숫자(예로, 8)가 인덱스 스케일로 변환되면 1일 수 있다. 프로세서(120)는 제3 모듈(50)을 통해 제3 스케일링 인자를 식별된 최소 숫자에 대응되는 인덱스 스케일로 변환하고, 변환된 최소 숫자에 기초하여 제1 출력 데이터 중 LSB를 기준으로 하위 제5 비트를 제거하고, 제거된 제5 비트만큼 가드 비트를 부가하여 제2 출력 데이터를 출력할 수 있다.
이 때, 하위 제5 비트는 유효 숫자를 나타내는 S-I 비트 중 LSB를 기준으로 하위 영역에 위치한 비트를 의미할 수 있다. 예로, 제3 스케일링 인자가 5에서 인덱스 스케일 1로 변환되면, 프로세서(120)는 19bits의 가수 부분 중 MSB를 기준으로 상위 bit 4보다 하위에 있는 비트(또는, 가수 부분 중 LSB를 기준으로 하위 bit 15) (제5 비트)는 제거할 수 있다. 그리고, 프로세서(120)는 제5 비트만큼 가드 비트를 남아 있는 상위 4 bit 왼쪽 부분에 부가할 수 있다.
도 2에 도시된 바와 같이, 프로세서(120)는 제2 출력 데이터(55) 및 버퍼(또는, 누적 버퍼)(65)에 저장된 제3 출력 데이터를 제4 모듈(60)에 입력하여 제2 출력 데이터와 제3 출력 데이터가 가산된 제4 출력 데이터를 획득할 수 있다.
제4 모듈(60)은 QF(Quantum Floating) Adder 모듈로 표현될 수 있다. 제4 모듈(60)은 제2 출력 데이터(55)의 제1 단위 스케일링 인자 및 제3 출력 데이터의 제2 단위 스케일링 인자 중 크기가 더 큰 스케일링 인자를 식별하고, 식별된 크기가 더 큰 단위 스케일링 인자로 제2 출력 데이터 및 제3 출력 데이터의 단위 스케일을 정렬하고, 단위 스케일이 정렬된 제2 출력 데이터 및 제3 출력 데이터를 가산하여 제4 출력 데이터를 출력하는 모듈이다. 이와 관련된 실시예는 도 5a 및 도 5b를 참조하여 구체적으로 설명하도록 한다.
본 개시의 일 실시예로, 도 5a 및 도 5b는 제1 출력 데이터가 제2 출력 데이터로 변환되고 버퍼에 저장된 제3 출력 데이터와 합 연산을 수행하는 과정을 설명하기 위한 도면이다.
본 개시의 또 다른 실시예로, 도 5a에 도시된 바와 같이, 프로세서(120)는 제3 스케일링 인자(510) 및 제1 출력 데이터(515)를 제3 모듈(50)에 입력하여 제2 출력 데이터를 획득할 수 있다. 프로세서(120)는 제2 출력 데이터 및 제3 출력 데이터(507)를 제4 모듈(60)에 입력하여 제4 출력 데이터를 획득할 수 있다.
프로세서(120)는 제4 모듈(60)을 통해 제2 출력 데이터의 제1 단위 스케일링 인자(또는, 제1 인덱스 스케일)과 제3 출력 데이터(507)의 제2 단위 스케일링 인자(520) 중 크기가 더 큰 단위 스케일링 인자를 식별할 수 있다.
예로, 제1 출력 데이터의 제3 스케일링 인자(510)가 제1 단위 스케일링 인자(예로, 1)로 변환되었으므로, 제1 단위 스케일링 인자는 제2 단위 스케일링 인자보다 작다. 이에 따라, 프로세서(120)는 제4 모듈(60)을 통해 식별된 크기가 더 큰 단위 스케일링 인자(예로, 2)로 제2 출력 데이터 및 제3 출력 데이터의 단위 스케일링 인자를 정렬할 수 있다.
예로, 프로세서(120)는 제4 모듈(60)을 통해 제2 출력 데이터의 제1 단위 스케일링 인자를 1에서 제2 단위 스케일링 인자와 동일한 2로 변환할 수 있다. 그리고, 프로세서(120)는, 제4 모듈(60)을 통해, 변환된 단위 스케일링 인자에 맞게 정렬된 제2 출력 데이터(505)를 획득할 수 있다. 제1 출력 데이터의 가수 부분이 19bit였던 경우, 프로세서(120)는 제4 모듈(60)을 통해 제1 단위 스케일링 인자를 2로 정렬하면서 가수 부분의 MSB를 기준으로 상위 8 bit를 제외한 나머지 bit는 제거하고 bit 11을 가드 비트로 부가할 수 있다.
그리고, 프로세서(120)는 제4 모듈(60)을 통해 단위 스케일이 정렬된 제2 출력 데이터와 제3 출력 데이터가 합산된 제4 출력 데이터를 획득할 수 있다.
본 개시의 또 다른 실시예로, 도 5b를 참조하면, 프로세서(120)는 제3 스케일링 인자(540) 및 제1 출력 데이터(545)를 제3 모듈(50)에 입력하여 제2 출력 데이터(512)를 획득할 수 있다. 프로세서(120)는 제2 출력 데이터(512) 및 제3 출력 데이터(513)를 제4 모듈(60)에 입력하여 제4 출력 데이터를 획득할 수 있다.
프로세서(120)는 제4 모듈(60)을 통해 제2 출력 데이터(512)의 제1 단위 스케일링 인자(또는, 제1 인덱스 스케일)(560)와 제3 출력 데이터(513)의 제2 단위 스케일링 인자(550) 중 크기가 더 큰 단위 스케일링 인자를 식별할 수 있다. 제1 출력 데이터의 제1 스케일링 인자(540)가 제1 단위 스케일링 인자(예로, 3)로 변환되었으므로, 제1 단위 스케일링 인자는 제2 단위 스케일링 인자(예로, 2)보다 크다.
이에 따라, 프로세서(120)는 제4 모듈(60)을 통해 식별된 크기가 더 큰 단위 스케일링 인자(예로, 3)로 제2 출력 데이터 및 제3 출력 데이터의 단위 스케일링 인자를 정렬할 수 있다. 예로, 프로세서(120)는 제4 모듈(60)을 통해 제3 출력 데이터의 제2 단위 스케일 인자를 2에서 제1 단위 스케일과 동일한 3으로 변환할 수 있다. 그리고, 프로세서(120)는 제4 모듈(60)을 통해 변환된 단위 스케일 인자에 기초하여 단위 스케일 인자가 정렬된 제3 출력 데이터(514)를 획득할 수 있다. 그리고, 프로세서(120)는 제4 모듈(60)을 통해 단위 스케일이 정렬된 제2 출력 데이터 및 제3 출력 데이터가 합산된 제4 출력 데이터를 획득할 수 있다.
프로세서(120)는 획득된 제4 출력 데이터를 제1 비트를 단위 스케일로 나타내는 부동 소수점 형태로 변환되도록 정규화(normalize)하고, 정규화된 데이터를 버퍼(65)에 저장할 수 있다. 구체적으로, 프로세서(120)의 획득된 제4 출력 데이터를 레지스터(63)에 일시적으로 저장한 후, 버퍼(65)에 저장되도록 제어할 수 있다. 레지스터는 프로세서(120)가 수행하는 각종 명령, 명령의 대상이 되는 데이터를 일시적으로 유지하거나 저장하는 공간을 의미한다.
예를 들면, 도 6a에 도시된 바와 같이, 제2 출력 데이터 및 제3 출력 데이터를 합산하면서 오버 플러우(overflow)가 발생된 경우, 프로세서(120)는 인덱스 스케일을 1 증가(예를 들어, 3에서 4로) 시킬 수 있다. 그리고, 프로세서(120)는 가수 부분 중 bit 11에서 LSB를 기준으로 하위 bit 8을 제거할 수 있다.
또 다른 예로, 도 6b에 도시된 바와 같이, 제4 출력 데이터(630)가 양수일 때 가수 부분의 MSB를 기준으로 상위에 위치한 부분이 모두 0인 경우, 또는 제4 출력 데이터(630)가 음수일 때, 가수 부분의 MSB를 기준으로 상위에 위치한 부분이 모두 1인 경우, 그에 맞는 제4 출력 데이터(630)의 인덱스 스케일(635)을 감소시켜야 한다. 구체적으로, 프로세서(120)는 블락 단위로 0 또는 1을 검출함으로써, 인덱스 스케일 인자를 감소시킬지 여부를 결정할 수 있다.
예를 들어, 제4 출력 데이터(630)가 양수인 경우를 가정한다. 프로세서(120)는 제4 출력 데이터의 첫 번째 블락(650)에서 1이 검출되면, 인덱스 스케일을 유지할 수 있다. 프로세서(120)는 제4 출력 데이터의 두 번째 블락(645)에서 최초 1(또는, leading 1)이 검출되면 인덱스 스케일을 1 낮출 수 있다. 프로세서(120)는 세 번째 블락(640)에서 최초 1이 검출되면, 인덱스 스케일을 2 낮출 수 있다. 프로세서(120)는 세 번째 블락(640)에서도 1이 검출되지 않으면 제4 출력 데이터를 0으로 식별할 수 있다.
본 개시의 또 다른 실시예로, 프로세서(120)는 제4 출력 데이터(630) 중 첫 번째 블락(650)에서 최초 1이 검출되는지 여부에 기초하여 인덱스 스케일을 조정할 수 있다. 예를 들어, 제4 출력 데이터(630)가 양수인 경우를 가정할 때, 첫 번째 블락(650)에서 최초 1이 검출되지 않으면, 프로세서(120)는 인덱스 스케일을 1 낮추고, 첫 번째 블락(650)에서 최초 1이 검출되면, 프로세서(120)는 인덱스 스케일을 유지할 수 있다. 한편, 제4 출력 데이터(630)가 음수인 경우, 프로세서(120)는 제4 출력 데이터(630) 중 첫 번째 블락(650)에서 최초 0이 검출되는지 여부에 기초하여 인덱스 스케일을 조정할 수 있다.
신경망 모델 상에서 연산을 수행할 때, 급격한 스케일 변화가 발생되는 경우는 많지 않다. 프로세서(120)가 첫 번째 블락(650) 상에서만 최초 1 또는 최초 0이 검출되는지 여부에 기초하여 인덱스 스케일을 조정하더라도 정확도가 크게 떨어지지 않는다. 따라서, 전자 장치(100)는 제4 출력 데이터(630)의 첫 번째 블락만을 이용하여 정규화(normalize) 동작을 수행함으로서 정규화 동작을 수행하는 모듈이 차지하는 면적의 크기를 감소시킬 수 있다.
프로세서(120)는 제1 출력 데이터를 퀀텀 부동 소수점 형태로 변환하여 비트 수를 감소시킬 수 있다. 그리고, 프로세서(120)는 비트 수가 감소된 데이터 간에 가산 연산을 수행하여 획득된 제4 출력 데이터를 버퍼에 저장함으로써 버퍼의 워드 사이즈(word size)를 감소시킬 수 있다.
즉, 프로세서(120)는 데이터의 비트를 가변적으로 제거하고, 퀀텀 부동 소수점 형태로 변환된 데이터에 기초하여 가산 연산을 수행함으로써, 각 모듈이 차지하는 면적의 크기를 감소시키고 전력 소모를 감소시킬 수 있다.
도 7은 본 개시의 일 실시예에 따른, 전자 장치(100)의 구성을 상세히 도시한 블록도이다. 도 7에 도시된 바와 같이, 전자 장치(100)는 메모리(110), 프로세서(120), 디스플레이(130), 입력부(140), 통신부(150), 스피커(160) 및 마이크(170)를 포함할 수 있다. 메모리(110) 및 프로세서(120)에 대한 설명은 전술하였으므로 중복되는 설명은 생략하도록 한다.
디스플레이(130)는 프로세서(120)의 제어에 따라 다양한 정보를 표시할 수 있다. 특히, 디스플레이(130)는 제1 입력 데이터를 표시하거나, 가중치 데이터와 입력 데이터 간에 연산을 수행하여 획득된 제4 출력 데이터를 표시할 수 있다. 여기서, 제4 출력 데이터를 표시한다는 것은 제4 출력 데이터에 기초하여 생성된 텍스트 또는 이미지가 포함된 화면을 표시하는 동작을 포함할 수 있다. 즉, 디스플레이(130)는 신경망 모델을 통해 출력된 결과를 표시할 수 있다.
디스플레이(130)는 LCD(Liquid Crystal Display), OLED(Organic Light Emitting Diodes), AM-OLED(Active-Matrix Organic Light-Emitting Diode), LcoS(Liquid Crystal on Silicon) 또는 DLP(Digital Light Processing) 등과 같은 다양한 디스플레이 기술로 구현될 수 있다. 또한, 디스플레이(130)는 플렉서블 디스플레이(flexible display)의 형태로 전자 장치(100)의 전면 영역 및, 측면 영역 및 후면 영역 중 적어도 하나에 결합될 수도 있다.
입력부(140)는 회로를 포함하며, 전자 장치(100)를 제어하기 위한 사용자 입력을 수신할 수 있다. 특히, 입력부(140)는 사용자 손 또는 스타일러스 펜 등을 이용한 사용자 터치를 입력받기 위한 터치 패널, 사용자 조작을 입력받기 위한 버튼 등이 포함될 수 있다. 또 다른 예로, 입력부(140)는 다른 입력 장치(예로, 키보드, 마우스, 모션 입력부 등)로 구현될 수 있다. 한편, 입력부(140)는 사용자로부터 입력된 제1 입력 데이터를 수신하거나 각종 사용자 명령을 입력받을 수 있다.
통신부(150)는 회로를 포함하며, 외부 장치와 통신을 수행할 수 있다. 이때, 통신부(150)가 외부 장치와 통신 연결되는 것은 제3 기기(예로, 중계기, 허브, 엑세스 포인트, 서버 또는 게이트웨이 등)를 거쳐서 통신하는 것을 포함할 수 있다.
통신부(150)는 외부 장치와 통신을 수행하기 위해 다양한 통신 모듈을 포함할 수 있다. 일 예로, 통신부(150)는 무선 통신 모듈을 포함할 수 있으며, 예를 들면, 5G(5TH Generation), LTE(Long-Term Evolution), LTE-A(LTE-Advance), CDMA(code division multiple access), WCDMA(wideband CDMA), 등 중 적어도 하나를 사용하는 셀룰러 통신 모듈을 포함할 수 있다.
다른 예로, 무선 통신 모듈은, 예를 들면, WiFi(wireless fidelity), 블루투스, 블루투스 저전력(BLE), 지그비(Zigbee), 라디오 프리퀀시(RF), 또는 보디 에어리어 네트워크(BAN) 중 적어도 하나를 포함할 수 있다. 다만, 이는 일 실시예에 불과하며 통신부(150)는 유선 통신 모듈을 포함할 수 있다.
통신부(150)는 전자 장치(100)와 통신 연결된 외부 장치로부터 각종 제1 입력 데이터를 수신할 수 있다. 예를 들어, 통신부(150)는 전자 장치(100)와 무선 통신 연결된 입력 장치(예를 들어, 카메라, 마이크, 키보드 등) 또는 각종 컨텐츠를 제공할 수 있는 외부 서버로부터 다양한 종류의 제1 입력 데이터를 수신할 수 있다.
스피커(160)는 오디오 처리부(미도시)에 의해 디코딩이나 증폭, 노이즈 필터링과 같은 다양한 처리 작업이 수행된 각종 오디오 데이터를 출력하는 구성이다. 또한, 스피커(160)는 각종 알림 음이나 음성 메시지를 출력할 수 있다.
예를 들어, 스피커(160)는 신경망 모델에 의해 가중치 데이터와 입력 데이터 간의 연산 결과(예를 들어, 제4 출력 데이터 또는 제4 출력 데이터에 기초하여 생성된 텍스트 또는 이미지)가 획득되었다는 알림음을 출력할 수 있다.
마이크(170)는 사용자로부터 음성을 입력받을 수 있는 구성이다. 마이크(170)는 전자 장치(100) 내부에 구비될 수 있으나, 외부에 구비되어 전자 장치(100)와 전기적으로 연결될 수 있다. 또한, 마이크(170)가 외부에 구비된 경우, 마이크(170)는 유/무선 인터페이스(예를 들어, Wi-Fi, 블루투스)을 통해 생성된 사용자 음성 신호를 프로세서(120)에 전송할 수 있다.
마이크(170)는 각종 인공 신경망으로 구성된 인공지능 모델을 활성화시킬 수 있는 웨이크 업 워드(wake-up word)(또는, 트리거 워드(trigger word))가 포함된 사용자 음성을 입력 받을 수 있다. 웨이크 업 워드가 포함된 사용자 음성을 마이크(170)를 통해 입력받으면, 프로세서(120)는 인공 지능 모델을 활성화시키고 사용자 음성을 제1 입력 데이터로 이용하여 가중치 데이터간의 연산을 수행할 수 있다.
한편, 본 개시에 따른 인공지능과 관련된 기능은 프로세서(120)와 메모리(110)를 통해 동작된다. 프로세서(120)는 하나 또는 복수의 프로세서로 구성될 수 있다. 이때, 하나 또는 복수의 프로세서는 CPU, AP(Application Processor), DSP(Digital Signal Processor) 등과 같은 범용 프로세서, GPU, VPU(Vision Processing Unit)와 같은 그래픽 전용 프로세서 또는 NPU(Neural Processing Unit)와 같은 인공지능 전용 프로세서일 수 있다.
하나 또는 복수의 프로세서(120)는, 메모리(110)에 저장된 기 정의된 동작 규칙 또는 인공지능 모델에 따라, 입력 데이터를 처리하도록 제어한다. 또는, 하나 또는 복수의 프로세서가 인공지능 전용 프로세서인 경우, 인공지능 전용 프로세서는, 특정 인공지능 모델의 처리에 특화된 하드웨어 구조로 설계될 수 있다.
기 정의된 동작 규칙 또는 인공지능 모델은 학습을 통해 만들어진 것을 특징으로 한다. 여기서, 학습을 통해 만들어진다는 것은, 기본 인공지능 모델이 학습 알고리즘에 의하여 다수의 학습 데이터들을 이용하여 학습됨으로써, 원하는 특성(또는, 목적)을 수행하도록 설정된 기 정의된 동작 규칙 또는 인공지능 모델이 만들어짐을 의미할 수 있다. 이러한 학습은 본 개시에 따른 인공지능이 수행되는 기기 자체에서 이루어질 수도 있고, 별도의 서버 및/또는 시스템을 통해 이루어 질 수도 있다.
학습 알고리즘의 예로는, 지도형 학습(supervised learning), 비지도형 학습(unsupervised learning), 준지도형 학습(semi-supervised learning) 또는 강화 학습(reinforcement learning)이 있으나, 전술한 예에 한정되지 않는다.
인공지능 모델은 복수의 인공 신경망을 포함하며, 인공 신경망은 복수의 레이어들로 구성될 수 있다. 복수의 신경망 레이어들 각각은 복수의 가중치들(weight values)을 갖고 있으며, 이전(previous) 레이어의 연산 결과와 복수의 가중치들 간의 연산을 통해 신경망 연산을 수행한다. 복수의 신경망 레이어들이 갖고 있는 복수의 가중치들은 인공지능 모델의 학습 결과에 의해 최적화될 수 있다. 예를 들어, 학습 과정 동안 인공지능 모델에서 획득한 로스(loss) 값 또는 코스트(cost) 값이 감소 또는 최소화되도록 복수의 가중치들이 갱신될 수 있다.
인공 신경망의 예로는, CNN (Convolutional Neural Network), DNN (Deep Neural Network), RNN (Recurrent Neural Network), RBM (Restricted Boltzmann Machine), DBN (Deep Belief Network), BRDNN(Bidirectional Recurrent Deep Neural Network) 및 심층 Q-네트워크 (Deep Q-Networks) 등이 있으며, 본 개시에서의 인공 신경망은 명시한 경우를 제외하고 전술한 예에 한정되지 않는다.
도 8은 본 개시의 일 실시예에 따른, 전자 장치(100)의 제어 방법을 설명하기 위한 순서도이다.
전자 장치(100)는 제1 입력 데이터 및 제1 가중치 데이터 각각을 제1 모듈에 입력하여 제1 입력 데이터 중 일부가 제거된 제2 입력 데이터 및 제1 가중치 데이터 중 일부가 제거된 제2 가중치 데이터 각각을 획득할 수 있다(S810).
구체적으로, 전자 장치(100)는 입력된 데이터의 MSB를 기준으로 상위 제2 비트(bit) 중 유효 값이 포함된 최상위 비트를 식별하고, 식별된 최상위 비트에 기초하여 입력된 데이터의 LSB를 기준으로 제거될 하위 비트를 나타내는 스케일링 인자를 식별하고, 스케일링 인자에 기초하여 입력된 데이터 중 일부를 제거하는 제1 모듈을 이용하여 제2 입력 데이터 및 제2 가중치 데이터를 획득할 수 있다.
한편, 전자 장치(100)는, 제1 모듈을 통해, 제1 입력 데이터의 상기 제2 비트 중 유효 값이 포함된 제1 최상위 비트를 식별하고, 제2 비트 중 제1 최상위 비트보다 상위에 위치한 제3 비트를 식별하고, 제2 비트와 제3 비트 간의 차이를 제1 입력 데이터에 대응되는 제1 스케일링 인자로 식별할 수 있다. 또 다른 예로, 전자 장치(100)는, 제1 모듈을 통해, 제1 가중치 데이터의 제2 비트 중 유효 값이 포함된 제2 최상위 비트를 식별하고, 제2 비트 중 제2 최상위 비트보다 상위에 위치한 제4 비트를 식별하고, 제2 비트와 제4 비트 간의 차이를 제1 가중치 데이터에 대응되는 제2 스케일링 인자로 식별할 수 있다.
그리고, 전자 장치(100)는, 제1 모듈을 통해, 제1 입력 데이터 중 제3 비트에 대응되는 데이터 및 제1 스케일링 인자에 대응되는 데이터를 제거하여 제2 입력 데이터를 획득할 수 있다. 또 다른 예로, 전자 장치(100)는, 제1 모듈을 통해, 제1 가중치 데이터 중 제4 비트에 대응되는 데이터 및 제2 스케일 인자에 대응되는 데이터를 제거하여 제2 가중치 데이터를 획득할 수 있다.
전자 장치(100)는 제2 입력 데이터 및 제2 가중치 데이터를 곱 연산을 수행하는 제2 모듈에 입력하여 제1 출력 데이터 획득할 수 있다(S820).
전자 장치(100)는, 제1 모듈을 통해 식별된 제1 입력 데이터 및 제1 가중치 데이터 각각의 스케일링 인자에 기초하여, 획득된 제1 출력 데이터에 대해 제1 비트를 단위 스케일로 나타내는 부동 소수점 형태로 변환하여 제2 출력 데이터 획득할 수 있다(S830).
구체적으로, 전자 장치(100)는 제1 모듈을 통해 식별된 제1 입력 데이터 및 제1 가중치 데이터 각각의 스케일링 인자를 합산하여 제3 스케일링 인자를 획득할 수 있다. 그리고, 전자 장치(100)는 제3 스케일 값 및 제1 출력 데이터를 제3 모듈에 입력하여 제2 출력 데이터를 획득할 수 있다. 제3 모듈은 제3 스케일링 인자를 단위 스케일 형태로 변환하고, 변환된 단위 스케일 형태에 기초하여 제1 출력 데이터 중 LSB를 기준으로 하위 제5 비트를 제거하고, 제거된 제5 비트만큼 가드 비트를 부가하여 제2 출력 데이터를 출력하는 모듈이다.
전자 장치(100)는 제2 출력 데이터 및 버퍼에 기 저장된 제3 출력 데이터를 제4 모듈에 입력하여 제2 출력 데이터와 상기 제3 출력 데이터가 가산된 제4 출력 데이터를 획득할 수 있다. 그리고, 전자 장치(100)는 제4 출력 데이터를 제1 비트를 단위 스케일로 나타내는 부동 소수점 형태로 변환되도록 정규화하고, 정규화된 데이터를 버퍼에 저장할 수 있다.
한편, 상술한 본 개시의 다양한 실시 예들에 따른 방법들은, 기존 전자 장치에 설치 가능한 어플리케이션 형태로 구현될 수 있다.
또한, 상술한 본 개시의 다양한 실시 예들에 따른 방법들은, 기존 전자 장치에 대한 소프트웨어 업그레이드, 또는 하드웨어 업그레이드 만으로도 구현될 수 있다.
또한, 상술한 본 개시의 다양한 실시 예들은 전자 장치에 구비된 임베디드 서버, 또는 전자 장치 및 디스플레이 장치 중 적어도 하나의 외부 서버를 통해 수행되는 것도 가능하다.
한편, 본 개시의 일시 예에 따르면, 이상에서 설명된 다양한 실시 예들은 기기(machine)(예: 컴퓨터)로 읽을 수 있는 저장 매체(machine-readable storage media)에 저장된 명령어를 포함하는 소프트웨어로 구현될 수 있다. 기기는, 저장 매체로부터 저장된 명령어를 호출하고, 호출된 명령어에 따라 동작이 가능한 장치로서, 개시된 실시 예들에 따른 전자 장치를 포함할 수 있다. 명령이 프로세서에 의해 실행될 경우, 프로세서가 직접, 또는 프로세서의 제어 하에 다른 구성요소들을 이용하여 명령에 해당하는 기능을 수행할 수 있다.
명령은 컴파일러 또는 인터프리터에 의해 생성 또는 실행되는 코드를 포함할 수 있다. 기기로 읽을 수 있는 저장매체는, 비일시적(non-transitory) 저장매체의 형태로 제공될 수 있다. 여기서, '비일시적은 저장매체'는 신호(signal)를 포함하지 않으며 실재(tangible)한다는 것을 의미할 뿐 데이터가 저장매체에 반영구적 또는 임시적으로 저장됨을 구분하지 않는다. 예로, '비일시적 저장매체'는 데이터가 임시적으로 저장되는 버퍼를 포함할 수 있다.
또한, 본 개시의 일 실시 예에 따르면, 이상에서 설명된 다양한 실시 예들에 따른 방법은 컴퓨터 프로그램 제품(computer program product)에 포함되어 제공될 수 있다. 컴퓨터 프로그램 제품은 상품으로서 판매자 및 구매자 간에 거래될 수 있다. 컴퓨터 프로그램 제품은 기기로 읽을 수 있는 저장 매체(예: compact disc read only memory (CD-ROM))의 형태로, 또는 어플리케이션 스토어(예: 플레이 스토어TM)를 통해 온라인으로 배포될 수 있다. 온라인 배포의 경우에, 컴퓨터 프로그램 제품의 적어도 일부는 제조사의 서버, 어플리케이션 스토어의 서버, 또는 중계 서버의 메모리와 같은 저장 매체에 적어도 일시 저장되거나, 임시적으로 생성될 수 있다.
또한, 상술한 다양한 실시 예들에 따른 구성 요소(예: 모듈 또는 프로그램) 각각은 단수 또는 복수의 개체로 구성될 수 있으며, 전술한 해당 서브 구성 요소들 중 일부 서브 구성 요소가 생략되거나, 또는 다른 서브 구성 요소가 다양한 실시 예에 더 포함될 수 있다. 대체적으로 또는 추가적으로, 일부 구성 요소들(예: 모듈 또는 프로그램)은 하나의 개체로 통합되어, 통합되기 이전의 각각의 해당 구성 요소에 의해 수행되는 기능을 동일 또는 유사하게 수행할 수 있다. 다양한 실시 예들에 따른, 모듈, 프로그램 또는 다른 구성 요소에 의해 수행되는 동작들은 순차적, 병렬적, 반복적 또는 휴리스틱하게 실행되거나, 적어도 일부 동작이 다른 순서로 실행되거나, 생략되거나, 또는 다른 동작이 추가될 수 있다.
이상에서는 본 개시의 바람직한 실시 예에 대하여 도시하고 설명하였지만, 본 개시는 상술한 특정의 실시 예에 한정되지 아니하며, 청구범위에서 청구하는 본 개시의 요지를 벗어남이 없이 당해 개시에 속하는 기술분야에서 통상의 지식을 가진 자에 의해 다양한 변형 실시가 가능한 것은 물론이고, 이러한 변형실시들은 본 개시의 기술적 사상이나 전망으로부터 개별적으로 이해되어져서는 안될 것이다.

Claims (15)

  1. 전자 장치에 있어서,
    제1 입력 데이터 및 신경망 모델의 연산에 이용되는 제1 가중치 데이터를 저장하는 메모리; 및
    상기 제1 입력 데이터 및 상기 제1 가중치 데이터를 제1 모듈에 입력하여 상기 제1 입력 데이터 중 일부가 제거(truncation)된 제2 입력 데이터 및 상기 제1 가중치 데이터 중 일부가 제거된 제2 가중치 데이터를 획득하고,
    상기 제2 입력 데이터 및 상기 제2 가중치 데이터를 곱 연산을 수행하는 제2 모듈에 입력하여 제1 출력 데이터를 획득하고,
    상기 제1 모듈을 통해 식별된 상기 제1 입력 데이터 및 상기 제1 가중치 데이터의 스케일링 인자(scaling factor)에 기초하여, 상기 획득된 제1 출력 데이터에 대해 제1 비트를 단위 스케일로 나타내는 부동 소수점(floating point) 형태로 변환하여 제2 출력 데이터를 획득하는 프로세서;를 포함하는 전자 장치.
  2. 제1항에 있어서,
    상기 프로세서는, 제1 모듈을 통해,
    상기 제1 입력 데이터의 MSB(Most Significant Bit)를 기준으로 상위 제2 비트(bit) 중 유효 값이 포함된 최상위 비트를 식별하고, 상기 식별된 최상위 비트에 기초하여 상기 제1 입력 데이터의 LSB(Least Significant Bit)를 기준으로 제거될 하위 비트를 나타내는 스케일링 인자를 식별하고, 상기 스케일링 인자에 기초하여 상기 제1 입력 데이터 중 일부를 제거하는 것을 특징으로 하는 전자 장치.
  3. 제1항에 있어서,
    상기 프로세서는,
    상기 제1 모듈을 통해, 상기 제1 입력 데이터의 상기 제2 비트 중 유효 값이 포함된 제1 최상위 비트를 식별하고, 상기 제1 최상위 비트보다 상위에 위치한 제3 비트를 식별하고, 상기 제2 비트와 상기 제3 비트 간의 차이를 상기 제1 입력 데이터에 대응되는 제1 스케일링 인자로 식별하고,
    상기 제1 모듈을 통해, 상기 제1 가중치 데이터의 상기 제2 비트 중 상기 유효 값이 포함된 제2 최상위 비트를 식별하고, 상기 제2 최상위 비트보다 상위에 위치한 제4 비트를 식별하고, 상기 제2 비트와 상기 제4 비트 간의 차이를 상기 제1 가중치 데이터에 대응되는 제2 스케일링 인자로 식별하는 전자 장치.
  4. 제3항에 있어서,
    상기 프로세서는,
    상기 제1 모듈을 통해, 상기 제1 입력 데이터 중 상기 제3 비트에 대응되는 데이터 및 상기 제1 스케일링 인자에 대응되는 데이터를 제거하여 상기 제2 입력 데이터를 획득하고,
    상기 제1 모듈을 통해, 상기 제1 가중치 데이터 중 상기 제4 비트에 대응되는 데이터 및 상기 제2 스케일 인자에 대응되는 데이터를 제거하여 상기 제2 가중치 데이터를 획득하는 전자 장치.
  5. 제3항에 있어서,
    상기 프로세서는,
    상기 신경망 모델을 통해 출력될 결과의 유형을 식별하고,
    상기 식별된 유형의 결과를 출력하기 위해 필요한 연산 정확도를 식별하고,
    상기 식별된 연산 정확도가 높을수록 상기 제2 비트의 크기를 낮은 값으로 결정하고, 상기 식별된 연산 정확도가 낮을수록 상기 제2 비트의 크기를 큰 값으로 결정하는 전자 장치.
  6. 제1항에 있어서,
    상기 프로세서는,
    상기 제1 모듈을 통해 식별된 상기 제1 입력 데이터 및 상기 제1 가중치 데이터 각각의 스케일링 인자를 합산하여 제3 스케일링 인자를 획득하고,
    상기 제3 스케일 값 및 상기 제1 출력 데이터를 제3 모듈에 입력하여 상기 제2 출력 데이터를 획득하는 전자 장치.
  7. 제6항에 있어서,
    상기 프로세서는, 상기 제3 모듈을 통해,
    상기 제3 스케일링 인자를 상기 단위 스케일 형태로 변환하고, 상기 변환된 단위 스케일 형태에 기초하여 상기 제1 출력 데이터 중 LSB를 기준으로 하위 제5 비트를 제거하고, 상기 제거된 제5 비트만큼 가드 비트(guard bit)를 부가하여 상기 제2 출력 데이터를 출력하는 전자 장치.
  8. 제1항에 있어서,
    상기 메모리는 제1 비트를 단위 스케일 형태로 나타내는 부동 소수점 형태로 변환된 출력 데이터를 저장하는 버퍼(buffer)를 포함하고,
    상기 프로세서는,
    상기 제2 출력 데이터 및 상기 버퍼에 기 저장된 제3 출력 데이터를 제4 모듈에 입력하여 상기 제2 출력 데이터와 상기 제3 출력 데이터가 가산된 제4 출력 데이터를 획득하는 전자 장치.
  9. 제8항에 있어서,
    상기 프로세서는, 상기 제4 모듈을 통해,
    상기 제2 출력 데이터의 제1 단위 스케일링 인자 및 상기 제3 출력 데이터의 제2 단위 스케일링 인자 중 크기가 더 큰 단위 스케일링 인자를 식별하고, 상기 식별된 크기가 더 큰 단위 스케일링 인자로 상기 제2 출력 데이터 및 상기 제3 출력 데이터의 단위 스케일을 정렬하고, 상기 단위 스케일링 인자가 정렬된 제2 출력 데이터 및 상기 제3 출력 데이터를 가산하여 상기 제4 출력 데이터를 출력하는 전자 장치.
  10. 제8항에 있어서,
    상기 프로세서는,
    상기 획득된 제4 출력 데이터를 상기 제1 비트를 단위 스케일로 나타내는 부동 소수점 형태로 변환되도록 정규화(normalize)하고,
    상기 정규화된 데이터를 상기 버퍼에 저장하는 전자 장치.
  11. 제1 입력 데이터 및 신경망 모델의 연산에 이용되는 제1 가중치 데이터를 저장하는 메모리를 포함하는 전자 장치의 제어 방법에 있어서,
    상기 제1 입력 데이터 및 상기 제1 가중치 데이터를 제1 모듈에 입력하여 상기 제1 입력 데이터 중 일부가 제거된 제2 입력 데이터 및 상기 제1 가중치 데이터 중 일부가 제거된 제2 가중치 데이터를 획득하는 단계;
    상기 제2 입력 데이터 및 상기 제2 가중치 데이터를 곱 연산을 수행하는 제2 모듈에 입력하여 제1 출력 데이터를 획득하는 단계; 및
    상기 제1 모듈을 통해 식별된 상기 제1 입력 데이터 및 상기 제1 가중치 데이터의 스케일링 인자에 기초하여, 상기 획득된 제1 출력 데이터에 대해 제1 비트를 단위 스케일로 나타내는 부동 소수점 형태로 변환하여 제2 출력 데이터를 획득하는 단계;를 포함하는 제어 방법.
  12. 제11항에 있어서,
    상기 제어 방법은, 상기 제1 모듈을 통해,
    상기 제1 입력 데이터의 MSB를 기준으로 상위 제2 비트(bit) 중 유효 값이 포함된 최상위 비트를 식별하고, 상기 식별된 최상위 비트에 기초하여 상기 입력된 데이터의 LSB를 기준으로 제거될 하위 비트를 나타내는 스케일링 인자를 식별하고, 상기 스케일링 인자에 기초하여 상기 제1 입력 데이터 중 일부를 제거하는 것을 특징으로 하는 제어 방법.
  13. 제11항에 있어서,
    상기 제2 입력 데이터 및 상기 제2 가중치 데이터를 획득하는 단계는,
    상기 제1 모듈을 통해, 상기 제1 입력 데이터의 상기 제2 비트 중 유효 값이 포함된 제1 최상위 비트를 식별하고, 상기 제1 최상위 비트보다 상위에 위치한 제3 비트를 식별하고, 상기 제2 비트와 상기 제3 비트 간의 차이를 상기 제1 입력 데이터에 대응되는 제1 스케일링 인자로 식별하고,
    상기 제1 모듈을 통해, 상기 제1 가중치 데이터의 상기 제2 비트 중 상기 유효 값이 포함된 제2 최상위 비트를 식별하고, 상기 제2 최상위 비트보다 상위에 위치한 제4 비트를 식별하고, 상기 제2 비트와 상기 제4 비트 간의 차이를 상기 제1 가중치 데이터에 대응되는 제2 스케일링 인자로 식별하는 단계;를 포함하는 제어 방법.
  14. 제13항에 있어서,
    상기 제2 입력 데이터 및 상기 제2 가중치 데이터를 획득하는 단계는,
    상기 제1 모듈을 통해, 상기 제1 입력 데이터 중 상기 제3 비트에 대응되는 데이터 및 상기 제1 스케일링 인자에 대응되는 데이터를 제거하여 상기 제2 입력 데이터를 획득하고,
    상기 제1 모듈을 통해, 상기 제1 가중치 데이터 중 상기 제4 비트에 대응되는 데이터 및 상기 제2 스케일 인자에 대응되는 데이터를 제거하여 상기 제2 가중치 데이터를 획득하는 단계;를 포함하는 제어 방법.
  15. 제13항에 있어서,
    상기 신경망 모델을 통해 출력될 결과의 유형을 식별하는 단계;
    상기 식별된 유형의 결과를 출력하기 위해 필요한 연산 정확도를 식별하는 단계; 및
    상기 식별된 연산 정확도가 높으면, 상기 제2 비트의 크기를 제1 값으로 결정하고, 상기 식별된 연산 정확도가 낮으면, 상기 제2 비트의 크기를 상기 제1 값보다 큰 제2 값으로 결정하는 단계;를 포함하는 제어 방법.
PCT/KR2021/012448 2020-11-09 2021-09-14 전자 장치 및 이의 제어 방법 WO2022097902A1 (ko)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US17/527,305 US20220147806A1 (en) 2020-11-09 2021-11-16 Electronic device and method for controlling electronic device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
KR10-2020-0148619 2020-11-09
KR1020200148619A KR20220062892A (ko) 2020-11-09 2020-11-09 전자 장치 및 이의 제어 방법

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US17/527,305 Continuation US20220147806A1 (en) 2020-11-09 2021-11-16 Electronic device and method for controlling electronic device

Publications (1)

Publication Number Publication Date
WO2022097902A1 true WO2022097902A1 (ko) 2022-05-12

Family

ID=81457926

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/KR2021/012448 WO2022097902A1 (ko) 2020-11-09 2021-09-14 전자 장치 및 이의 제어 방법

Country Status (2)

Country Link
KR (1) KR20220062892A (ko)
WO (1) WO2022097902A1 (ko)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20190043849A (ko) * 2017-10-19 2019-04-29 삼성전자주식회사 뉴럴 네트워크의 파라미터를 양자화하는 장치 및 방법
CN110780845A (zh) * 2019-10-17 2020-02-11 浙江大学 一种用于量化卷积神经网络的可配置近似乘法器及其实现方法
US20200117981A1 (en) * 2018-10-11 2020-04-16 International Business Machines Corporation Data representation for dynamic precision in neural network cores
CN111178508A (zh) * 2019-12-27 2020-05-19 珠海亿智电子科技有限公司 用于执行卷积神经网络中全连接层的运算装置及方法
US20200234126A1 (en) * 2019-01-23 2020-07-23 Google Llc Look-up table based neural networks

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20190043849A (ko) * 2017-10-19 2019-04-29 삼성전자주식회사 뉴럴 네트워크의 파라미터를 양자화하는 장치 및 방법
US20200117981A1 (en) * 2018-10-11 2020-04-16 International Business Machines Corporation Data representation for dynamic precision in neural network cores
US20200234126A1 (en) * 2019-01-23 2020-07-23 Google Llc Look-up table based neural networks
CN110780845A (zh) * 2019-10-17 2020-02-11 浙江大学 一种用于量化卷积神经网络的可配置近似乘法器及其实现方法
CN111178508A (zh) * 2019-12-27 2020-05-19 珠海亿智电子科技有限公司 用于执行卷积神经网络中全连接层的运算装置及方法

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
WANG NAIGANG, CHOI JUNGWOOK, BRAND DANIEL, CHEN CHIA-YU, GOPALAKRISHNAN KAILASH: "Training Deep Neural Networks with 8-bit Floating Point Numbers", NIPS`18: PROCEEDINGS OF THE 32ND INTERNATIONAL CONFERENCE ON NEURAL INFORMATION PROCESSING SYSTEMS (NEURIPS 2018), 3 December 2018 (2018-12-03), XP055927989 *

Also Published As

Publication number Publication date
KR20220062892A (ko) 2022-05-17

Similar Documents

Publication Publication Date Title
US20200302288A1 (en) Using output equalization in training an artificial intelligence model in a semiconductor solution
CN111931922A (zh) 一种提高模型推断精度的量化方法
WO2019156283A1 (en) Dynamic memory mapping for neural networks
WO2020153626A1 (en) Electronic apparatus and control method thereof
US10747501B2 (en) Providing efficient floating-point operations using matrix processors in processor-based systems
WO2022097902A1 (ko) 전자 장치 및 이의 제어 방법
WO2020246724A1 (en) Electronic apparatus and method of performing operations thereof
WO2021235656A1 (en) Electronic apparatus and control method thereof
WO2021141210A1 (en) Electronic apparatus and controlling method thereof
WO2021230470A1 (ko) 전자 장치 및 그 제어 방법
WO2022010064A1 (ko) 전자 장치 및 그의 제어 방법
WO2022145676A1 (ko) 전자 장치 및 이의 제어 방법
WO2022075600A1 (ko) 전자 장치 및 이의 제어 방법
WO2023113445A1 (ko) 부동 소수점 연산 방법 및 장치
WO2023003432A1 (ko) 신경망의 양자화를 위한 포화 비율 기반 양자화 범위의 결정 방법 및 장치
WO2022182046A1 (en) Method and apparatus for regulating screen refresh rate
CN110837288B (zh) 应用程序管理方法、装置、移动终端及可读存储介质
WO2022131476A1 (ko) 인공지능 모델을 변환하는 전자 장치 및 그 동작 방법
CN112889024A (zh) 利用硬件计算效率和调整因子优化神经网络
WO2022239967A1 (ko) 전자 장치 및 이의 제어 방법
WO2021118260A1 (en) Electronic apparatus that monitors a safety function and a controlling method thereof
WO2021221256A1 (ko) 전자 장치 및 그의 제어 방법
EP4050523A1 (en) Method and apparatus for optimizing deep learning operator, device and storage medium
WO2021177617A1 (en) Electronic apparatus and method for controlling thereof
WO2022092445A1 (ko) 전자 장치 및 그 제어 방법

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21889367

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21889367

Country of ref document: EP

Kind code of ref document: A1