WO2022126644A1 - Model protection device, method, and computing device - Google Patents

Model protection device, method, and computing device Download PDF

Info

Publication number
WO2022126644A1
WO2022126644A1 PCT/CN2020/137748 CN2020137748W WO2022126644A1 WO 2022126644 A1 WO2022126644 A1 WO 2022126644A1 CN 2020137748 W CN2020137748 W CN 2020137748W WO 2022126644 A1 WO2022126644 A1 WO 2022126644A1
Authority
WO
WIPO (PCT)
Prior art keywords
model
read
control signal
model protection
controller
Prior art date
Application number
PCT/CN2020/137748
Other languages
French (fr)
Chinese (zh)
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 PCT/CN2020/137748 priority Critical patent/WO2022126644A1/en
Priority to CN202080103291.0A priority patent/CN115956243A/en
Publication of WO2022126644A1 publication Critical patent/WO2022126644A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules

Definitions

  • the present application relates to the technical field of artificial intelligence (AI), and in particular, to a model protection device and method, and a computing device.
  • AI artificial intelligence
  • AI models are very valuable and valuable intellectual property, and it is of great significance to protect them.
  • AI models are mainly protected by legal means such as contracts to prevent the leakage and abuse of AI models, and there is no effective solution to technically protect AI models.
  • the application provides a model protection device and method, and a computing device, which can protect the AI model.
  • the technical solutions provided by the application are as follows:
  • the present application provides a model protection device, where the model protection device includes: an access authority controller and a memory controller.
  • the access authority controller is used to obtain a read command, and the read command is used to request to read the artificial intelligence AI model from the memory.
  • the access authority controller is also used to perform an authentication operation on the read instruction, and generate a control signal based on the authentication result, where the control signal is used to indicate whether to decrypt the AI model read from the memory.
  • the access rights controller is also used to send read commands to the memory controller.
  • the memory controller is used to read the AI model from the memory based on the read instruction.
  • the read command is authenticated by the access authority controller, and an indication of whether to decrypt the AI model read from the memory can be generated.
  • the AI model is stored in the memory in the form of an encrypted model, if the control signal indicates that the AI Only after the model is decrypted can the AI model be successfully used. If the control signal indicates that the AI model is not decrypted, the AI model cannot be used. Therefore, by controlling the process of decrypting the AI model, it can prevent the copying, leaking and misuse of AI, realize the protection of the AI model, help to establish a perfect AI model ecology, and build a safe and reasonable profit model.
  • the access authority controller is specifically configured to: acquire a read address for reading the AI model included in the read instruction, and perform an authentication operation on the read instruction based on the read address.
  • the access authority controller can also obtain the valid address range in the memory of the AI model read by the read command, and according to the read address and the valid address range Address range, perform the authentication operation on the read command.
  • the effective address range of the AI model in the memory at least covers the real storage address of the AI model in the memory.
  • the effective address range of the AI model in the memory may be set according to the storage address of the AI model in the memory after the driver module stores the AI model in the memory.
  • the control signal includes a first control signal and a second control signal, the first control signal is used to instruct the AI model to be decrypted, and the second control signal is used to instruct not to decrypt the AI model.
  • the access authority controller is specifically configured to: generate a first control signal when the read address is a legal address; and generate a second control signal when the read address is an illegal address.
  • the read address is within the valid address range of the AI model, the read address is called a legal address, and when the read address is outside the valid address range of the AI model, the read address is called an illegal address.
  • the access authority controller may also perform the authentication operation according to other conditions than the read address.
  • a decryption authority identifier is stored in the model protection device, and the decryption authority identifier is used to indicate whether the AI model used by the current computing task is allowed to be decrypted.
  • the access authority controller is specifically used for: when the read address is a legal address and meets the specified requirements When the condition is met, the first control signal is generated; when the read address is an illegal address, and/or the specified condition is not met, the second control signal is generated.
  • the specified condition includes at least one of the following: the decryption permission identifier indicates that the AI model used by the current computing task is allowed to be decrypted, or the AI model is an encryption model.
  • the access authority controller may also set the decryption authority identifier according to whether the read address is a legal address.
  • the access authority controller determines that the read address is an illegal address, it can control the decryption authority identifier to indicate that all AI models used by the current computing task are not allowed to be decrypted.
  • the penalty mechanism for decrypting the AI model can be realized by judging the read address, that is, once the read address is determined to be an illegal address, the decryption permission flag is set to indicate that all AI models used in the current computing task are Decryption is not allowed.
  • the mechanism can set the decryption permission flag, so that the decryption permission flag indicates that all AI models used by the current computing task are not allowed to be decrypted, which can prevent the AI model from being attacked by the malicious model.
  • a decryption authority identifier can be set for multiple computing tasks serially executed by the computing device, and the decryption authority identifier can be used in different computing tasks. The value during the execution of the computing task indicates whether the AI model used during the corresponding computing task is allowed to be decrypted.
  • decryption permission identifiers may be set for different computing tasks respectively, and the decryption permission identifier set for each computing task is used to indicate whether the AI model used by the corresponding computing task is allowed to be decrypted.
  • the access authority controller may also reset the decryption authority identifier to indicate that decryption is permitted, so as to ensure that the The computing task executed after the computing task can obtain the AI model normally.
  • the decryption authority identifier can also be reset in other ways, for example, the decryption authority identifier can be reset by re-powering on the computing device.
  • Whether the AI model is an encrypted model can be determined according to the model manufacturer's protection requirements for the model.
  • the model manufacturer needs to protect the AI model, it can encrypt the AI model and set the encryption flag to indicate that the AI model is an encrypted model.
  • the model manufacturer does not need to protect the AI model, it does not need to encrypt the AI model, and set the encryption flag to indicate that the AI model is a non-encrypted model.
  • the process of performing the authentication operation by the access authority controller further includes: the access authority controller judges whether the received read command is a read command, and if the read command received by the access authority controller is not a read command, indicating The read command is not used to request to read the AI model from the memory, and the data read according to the read command does not need to be decrypted, and the access authority controller can generate a control signal for instructing not to decrypt the content read according to the read command.
  • the read command is used for requesting to read content such as data and computer programs, the read command is one of the read commands, and the read command is used to request to read the computer program.
  • the process of judging whether the read address is a legal address by the access authority controller the process of judging the content indicated by the decryption authority identifier, the process of judging whether the AI model is an encryption model, and the process of judging whether the received read command is a read command.
  • the execution order of the procedures can be set according to the application requirements.
  • the process of the access authority controller performing the authentication operation and generating the control signal according to the authentication result includes: the access authority controller obtains a read command; after the access authority controller receives the read command, the access authority controller determines the decryption authority
  • the identifier indicates whether the AI model used by the current computing task is allowed to be decrypted.
  • the access authority controller generates a second control signal; when the decryption authority identifier indicates the current computing task
  • the access authority controller determines whether the AI model is an encrypted model.
  • the access authority controller When the AI model is a non-encrypted model, the access authority controller generates a second control signal.
  • the access authority controller judges whether the read command is a read command for instructing to read the AI model, and when the read command is not a read command for instructing to read the AI model, the access authority controller generates a second control signal, when the read command is for When instructing to read the read command of the AI model, the access authority controller determines whether the read address is a legal address, and when the read address is a legal address, a first control signal is generated, and when the read address is an illegal address, the control decryption authority identifier indicates the current address. All AI models used by computing tasks are not allowed to be decrypted, and the access rights controller generates a second control signal.
  • the access authority controller when any one of the above judgment conditions is not satisfied, the access authority controller generates the second control signal, and there is no need to judge according to other judgment conditions, which can reduce the workload of the access authority controller and ensure the authentication efficiency.
  • the authentication process is first judged according to the above-mentioned decryption authority identifier, then judge whether the AI model is an encryption model, then judge whether the read command is a read command, and then judge whether the read address is a legal address, which can be based on the judgment conditions from coarse-grained. To achieve fine-grained judgment, it can further ensure the reliability of authentication.
  • the model protection device further includes: a first register, where the first register is used to store the effective address range of the AI model in the memory.
  • the access authority controller is specifically configured to read the effective address range from the first register, and perform an authentication operation on the read instruction based on the effective address range and the read address.
  • the first register may be a collective term for one or more registers used to implement the storage effective address range.
  • the effective address range can be represented by variables stored in two registers, one register for storing the starting address of the effective address range and the other register for storing the length of the effective address range, or the other register with to store the end address of the valid address range.
  • the model protection device further includes: a decryption circuit and a dedicated processor.
  • a dedicated processor is used to generate read commands and send them to the access rights controller.
  • the decryption circuit is used to receive the control signal generated by the access authority controller, and under the instruction of the control signal, decrypt the AI model and transmit it to the dedicated processor, or, under the instruction of the control signal, transparently transmit the AI to the dedicated processor Model.
  • Dedicated processors are also used to perform current computing tasks based on the AI model transmitted by the decryption circuit.
  • the model protection device further includes: a key generation circuit.
  • the key generation circuit is used to obtain the root key of the model protection device, the version ID of the AI model and the device ID of the model protection device, and based on the root key, version ID and device ID, generate a decryption key for decrypting the AI model. key.
  • the key generation circuit in order to ensure that the AI model can be decrypted using the decryption key, the key generation circuit generates a decryption key based on the root key, version ID and device ID. Identity, the implementation of generating the encryption key used to encrypt the AI model remains consistent. For example, the algorithm for generating the decryption key and the algorithm for generating the encryption key may be the same.
  • the model protection device further includes: a second register.
  • the second register is used to store the decryption key.
  • the decryption circuit in the model protection device is specifically configured to read the decryption key from the second register, and under the instruction of the control signal, use the decryption key to decrypt the AI model.
  • the decryption circuit when the decryption circuit decrypts the AI model, if the decryption key is the same as the encryption key used to encrypt the AI model, the decryption circuit can use the decryption key to successfully decrypt the AI model. If the encrypted encryption keys are different, the AI model cannot be decrypted.
  • the present application provides a computing device, the computing device comprising: a memory and the model protection device provided in the first aspect and any possible implementation manner thereof.
  • the computing device further includes a drive module, the drive module is used to receive the task request sent by the AI application, determine the AI model required by the task request according to the task request, and obtain the AI model from the non-volatile storage medium of the computing device.
  • the AI model then applies for memory from the memory controller, stores the data to be calculated carried by the AI model and the task request in the memory allocated by the memory controller, and sends a task execution instruction to the dedicated processor to instruct the dedicated processor to execute The computational task requested by the task request to be performed.
  • the task execution instruction is used to notify the dedicated processor of task information such as the storage address of the data to be calculated in the memory and the storage address of the AI model in the memory.
  • the dedicated processor is configured to send a read instruction after receiving the task execution instruction.
  • the present application provides a model protection method.
  • the model protection method is applied to a model protection device.
  • the model protection device includes: an access authority controller and a memory controller.
  • the model protection method includes: an access authority controller obtains a read instruction, and the read instruction is used to request to read an artificial intelligence AI model from a memory; the access authority controller performs an authentication operation on the read instruction, and generates a control signal based on the authentication result, The control signal is used to indicate whether to decrypt the AI model read from the memory; the access authority controller sends the read command to the memory controller; the memory controller reads the AI model from the memory based on the read command.
  • the access authority controller performs an authentication operation on the read instruction, including: the access authority controller obtains a read address for reading the AI model included in the read instruction, and performs an authentication operation on the read instruction based on the read address.
  • control signal includes a first control signal and a second control signal
  • the first control signal is used to instruct the AI model to be decrypted
  • the second control signal is used to instruct not to decrypt the AI model
  • the access authority controller is based on authentication.
  • the control signal is generated, including: when the read address is a legal address, the access authority controller generates a first control signal; when the read address is an illegal address, the access authority controller generates a second control signal.
  • the control signal includes a first control signal and a second control signal
  • the first control signal is used to instruct the AI model to be decrypted
  • the second control signal is used to instruct not to decrypt the AI model
  • the decryption device is stored in the model protection device.
  • Authority identifier the decryption authority identifier is used to indicate whether the AI model used by the current computing task is allowed to be decrypted.
  • the access authority controller generates a control signal based on the authentication result, including: when the read address is a legal address and meets the specified conditions, the access authority control The controller generates a first control signal; when the read address is an illegal address and/or does not meet a specified condition, the access authority controller generates a second control signal.
  • the specified condition includes at least one of the following: the decryption permission identifier indicates that the AI model used by the current computing task is allowed to be decrypted; or, the AI model is an encryption model.
  • the model protection method further includes: when the read address is an illegal address, the access authority controller controls the decryption authority identifier to indicate that all AI models used by the current computing task are Decryption is not allowed.
  • the model protection method further includes: after completing the current computing task, the access authority controller resets the decryption authority identifier to indicate that decryption is permitted.
  • the model protection device further includes: a first register, where the first register is used to store the effective address range of the AI model in the memory, and the access authority controller performs an authentication operation on the read instruction, including: the access authority controller starts from the first register.
  • a valid address range is read from a register, and an authentication operation is performed on the read command based on the valid address range and the read address.
  • the model protection device further includes: a decryption circuit and a dedicated processor.
  • the model protection method further includes: the dedicated processor generates a read instruction and sends the read instruction to the access authority controller.
  • the model protection method further includes: the decryption circuit receives the control signal generated by the access authority controller, and under the instruction of the control signal, decrypts the AI model and transmits it to the dedicated The processor, or, under the instruction of the control signal, transparently transmits the AI model to the dedicated processor; the dedicated processor executes the current computing task based on the AI model transmitted by the decryption circuit.
  • the model protection device further includes: a key generation circuit.
  • the model protection method further includes: the key generation circuit obtains the root key of the model protection device, the version identification of the AI model and the device identification of the model protection device, and based on the root key, the version identification and the device identification, generates a method for performing the execution of the AI model. Decrypted decryption key.
  • the model protection device further includes: a second register, where the second register is used to store a decryption key, and after the access authority controller generates a control signal based on the authentication result, the model protection method further includes: decryption in the model protection device The circuit reads the decryption key from the second register, and uses the decryption key to decrypt the AI model under the instruction of the control signal.
  • the present application provides a computer device, the computer device includes: a processor and a memory, and a computer program is stored in the memory.
  • the processor executes the computer program
  • the computer device implements the model protection method provided in the third aspect and any possible implementation manner thereof.
  • the present application provides a computer-readable storage medium, where instructions are stored in the computer-readable storage medium, and when the instructions are executed by a processor, the third aspect and any possible implementation manner thereof are implemented.
  • the present application provides a model protection device.
  • the model protection device is used to obtain a read command, perform an authentication operation on the read command, and control whether to read an AI model from a memory based on the authentication result.
  • the read command is authenticated by the access authority controller, and according to the authentication result, it is controlled whether to read the AI model requested by the read command from the memory according to the read command.
  • the AI model is stored in the memory in the form of an encrypted model If the AI model can be read from the memory only after the authentication is passed, it is possible to use the AI model successfully. If the AI model cannot be read from the memory after the authentication is not passed, the AI model cannot be used. Therefore, by controlling the process of reading the AI model from the memory, it can prevent the copying, leakage and abuse of AI, realize the protection of the AI model, help to establish a perfect AI model ecology, and build a safe and reasonable profit model .
  • the model protection device includes: an access authority controller and a memory controller.
  • the access authority controller is used to acquire a read instruction, perform an authentication operation on the read instruction, generate a read instruction signal based on the authentication result, and send the read instruction signal and the read instruction to the memory controller.
  • the read indication signal is used to indicate whether to read the AI model from memory.
  • the memory controller is used to read the AI model from the memory based on the read instruction under the instruction of the read instruction signal, or, under the instruction of the read instruction signal, not to perform the operation of reading the AI model from the memory based on the read instruction.
  • the read indication signal includes a first read indication signal and a second read indication signal.
  • the first read indication signal is used to instruct the AI model to be read from the memory.
  • the second read indication signal is used to instruct not to read the AI model from the memory.
  • the access authority controller is configured to generate a first read instruction signal when the authentication of the read instruction is passed, and generate a second read instruction signal when the authentication of the read instruction fails.
  • the model protection device includes: an access authority controller and a memory controller.
  • the access authority controller is used to acquire the read command, perform an authentication operation on the read command, and determine whether to send the read command to the memory controller based on the authentication result.
  • the access authority controller is used to send the read command to the memory controller when the authentication of the read command is passed, so that the memory controller can read the AI model from the memory based on the read command;
  • the read command is intercepted, so that the memory controller cannot receive the read command, so that the AI model requested by the read command cannot be read from the memory.
  • the access authority controller is specifically used to: when the read address is a legal address, determine that the authentication of the read instruction is passed, and when the read address is an illegal address, determine the The authentication of the read command failed.
  • the read address is within the valid address range of the AI model
  • the read address is called a legal address
  • the read address is called an illegal address.
  • the model protection device stores a decryption authority identifier, and the decryption authority identifier is used to indicate whether the AI model used by the current computing task is allowed to be decrypted.
  • the decryption authority identifier is used to indicate whether the AI model used by the current computing task is allowed to be decrypted.
  • the specified condition includes at least one of the following: the decryption permission identifier indicates that the AI model used by the current computing task is allowed to be decrypted, or the AI model is an encryption model.
  • the present application provides a computing device, the computing device comprising: a memory and the model protection device provided in the sixth aspect and any possible implementation manner thereof.
  • the present application provides a model protection method.
  • the model protection method is applied to a model protection device.
  • the model protection device includes: an access authority controller and a memory controller.
  • the model protection method includes: acquiring a read instruction, performing an authentication operation on the read instruction, and controlling whether the memory controller reads out the AI model from the memory based on the authentication result.
  • the model protection method includes: the access authority controller obtains a read instruction, performs an authentication operation on the read instruction, generates a read indication signal based on the authentication result, and sends the read indication signal and the read instruction to a memory controller.
  • the read indication signal is used to indicate whether to read the AI model from memory.
  • the memory controller Under the instruction of the read instruction signal, the memory controller reads the AI model from the memory based on the read instruction, or, under the instruction of the read instruction signal, does not perform the operation of reading the AI model from the memory based on the read instruction.
  • the read indication signal includes a first read indication signal and a second read indication signal.
  • the first read indication signal is used to instruct the AI model to be read from the memory.
  • the second read indication signal is used to instruct not to read the AI model from the memory.
  • the access authority controller is configured to generate a first read instruction signal when the authentication of the read instruction is passed, and generate a second read instruction signal when the authentication of the read instruction fails.
  • the model protection method includes: the access authority controller obtains a read instruction, performs an authentication operation on the read instruction, and determines whether to send the read instruction to the memory controller based on the authentication result.
  • the access authority controller sends the read instruction to the memory controller, so that the memory controller can read the AI model from the memory based on the read instruction;
  • the read command is intercepted, so that the memory controller cannot receive the read command, so that the AI model requested by the read command cannot be read from the memory.
  • the access authority controller performs an authentication operation on the read instruction, including: when the read address is a legal address, determining that the authentication of the read instruction is passed, and when the read address is an illegal address, determining that the read instruction is authenticated. The authentication of the command failed.
  • a decryption authority identifier is stored in the model protection device, and the decryption authority identifier is used to indicate whether the AI model used by the current computing task is allowed to be decrypted, and the access authority controller performs an authentication operation on the read instruction, including: when the read address is When the address is legal and the specified conditions are met, it is determined that the authentication of the read instruction is passed; when the read address is an illegal address, and/or the specified conditions are not met, it is determined that the authentication of the read instruction fails.
  • the specified condition includes at least one of the following: the decryption permission identifier indicates that the AI model used by the current computing task is allowed to be decrypted, or the AI model is an encryption model.
  • the present application provides a computer device, the computer device includes: a processor and a memory, and a computer program is stored in the memory.
  • the processor executes the computer program
  • the computer device implements the model protection method provided in the eighth aspect and any possible implementation manner thereof.
  • the present application provides a computer-readable storage medium, where instructions are stored in the computer-readable storage medium, and when the instructions are executed by a processor, the eighth aspect and any possible implementation manner thereof are implemented.
  • the present application provides a model protection device.
  • the model protection device includes: an access authority control module and a memory controller; the access authority control module is used to obtain a read instruction, and the read instruction is used to request to read the artificial intelligence AI model from the memory; the access authority control module is also used to read the instruction. Execute the authentication operation, and generate a control signal based on the authentication result. The control signal is used to indicate whether to decrypt the AI model read from the memory; the access authority control module is also used to send the read command to the memory controller; memory control The processor is used to read AI models from memory based on read instructions.
  • the access authority control module is specifically configured to: obtain a read address for reading the AI model included in the read instruction, and perform an authentication operation on the read instruction based on the read address.
  • control signal includes a first control signal and a second control signal
  • the first control signal is used to instruct the AI model to be decrypted
  • the second control signal is used to instruct not to decrypt the AI model
  • the access authority control module is specifically used for :
  • the read address is a legal address
  • the first control signal is generated; when the read address is an illegal address, the second control signal is generated.
  • the control signal includes a first control signal and a second control signal
  • the first control signal is used to instruct the AI model to be decrypted
  • the second control signal is used to instruct not to decrypt the AI model
  • the decryption device is stored in the model protection device.
  • Authority identifier the decryption authority identifier is used to indicate whether the AI model used by the current computing task is allowed to be decrypted
  • the access authority control module is specifically used to: when the read address is a legal address and meet the specified conditions, generate the first control signal; when the read address is is an illegal address, and/or when the specified condition is not met, a second control signal is generated.
  • the specified condition includes at least one of the following: the decryption permission identifier indicates that the AI model used by the current computing task is allowed to be decrypted; or, the AI model is an encryption model.
  • the access authority control module is further configured to: when the read address is an illegal address, control the decryption authority identifier to indicate that all AI models used by the current computing task are not allowed to be decrypted.
  • the access authority control module is further configured to reset the decryption authority identifier to indicate that decryption is permitted after completing the current computing task.
  • the model protection device further includes: a first register, where the first register is used to store the effective address range of the AI model in the memory, and the access authority control module is specifically used for: reading the effective address range from the first register, based on The valid address range and read address perform the authentication operation on the read command.
  • the model protection device further includes: a decryption module and a dedicated processor, where the dedicated processor is used to generate a read instruction and send the read instruction to the access authority control module; the decryption module is used to receive the control signal generated by the access authority control module, And under the instruction of the control signal, the AI model is decrypted and transmitted to the dedicated processor, or, under the instruction of the control signal, the AI model is transparently transmitted to the dedicated processor; the dedicated processor is also used for the AI transmitted based on the decryption module. model, which executes the current computing task.
  • the model protection device further includes: a key generation module.
  • the key generation module is used to obtain the root key of the model protection device, the version ID of the AI model and the device ID of the model protection device, and generate a decryption key for decrypting the AI model based on the root key, version ID and device ID. key.
  • the model protection device further includes: a second register, the second register is used to store the decryption key, the decryption module is specifically configured to read the decryption key from the second register, and under the instruction of the control signal, the decryption key is used. key to decrypt the AI model.
  • the present application provides a model protection device.
  • the model protection device includes: an access authority control module and a memory controller.
  • the access authority control module is used to obtain the read command, perform an authentication operation on the read command, and control whether the memory controller reads the AI model from the memory based on the authentication result.
  • the access authority control module is specifically configured to acquire a read instruction, perform an authentication operation on the read instruction, generate a read indication signal based on the authentication result, and send the read indication signal and the read instruction to the memory controller .
  • the read indication signal is used to indicate whether to read the AI model from memory.
  • the memory controller is used to read the AI model from the memory based on the read instruction under the instruction of the read instruction signal, or, under the instruction of the read instruction signal, not to perform the operation of reading the AI model from the memory based on the read instruction.
  • the read indication signal includes a first read indication signal and a second read indication signal.
  • the first read indication signal is used to instruct the AI model to be read from the memory.
  • the second read indication signal is used to instruct not to read the AI model from the memory.
  • the access authority control module is specifically configured to generate a first read instruction signal when the authentication of the read instruction is passed, and generate a second read instruction signal when the authentication of the read instruction fails.
  • the access authority control module is specifically configured to acquire a read instruction, perform an authentication operation on the read instruction, and determine whether to send the read instruction to the memory controller based on the authentication result.
  • the access authority control module is specifically configured to send the read instruction to the memory controller when the authentication of the read instruction is passed, so that the memory controller can read the AI model from the memory based on the read instruction;
  • the read instruction is intercepted, so that the memory controller cannot receive the read instruction, so that the AI model requested by the read instruction cannot be read from the memory.
  • the access authority control module is specifically configured to acquire a read address for reading the AI model included in the read instruction, and perform an authentication operation on the read instruction based on the read address.
  • the access authority control module is specifically configured to determine that the authentication of the read instruction passes when the read address is a legal address, and determines that the authentication of the read instruction fails when the read address is an illegal address.
  • a decryption authority identifier is stored in the model protection device, and the decryption authority identifier is used to indicate whether the AI model used by the current computing task is allowed to be decrypted, and the access authority control module is specifically used for: when the read address is a legal address and meets the specified conditions.
  • the read instruction is passed, it is determined that the authentication of the read instruction is passed; when the read address is an illegal address, and/or the specified condition is not met, it is determined that the authentication of the read instruction is unsuccessful.
  • the specified condition includes at least one of the following: the decryption permission identifier indicates that the AI model used by the current computing task is allowed to be decrypted, or the AI model is an encryption model.
  • the access authority control module is further configured to: when the read address is an illegal address, control the decryption authority identifier to indicate that all AI models used by the current computing task are not allowed to be decrypted.
  • the access authority control module is further configured to reset the decryption authority identifier to indicate that decryption is permitted after completing the current computing task.
  • the model protection device further includes: a first register, where the first register is used to store the effective address range of the AI model in the memory.
  • the access authority control module is specifically configured to: read the effective address range from the first register, and perform an authentication operation on the read instruction based on the effective address range and the read address.
  • the model protection device further includes: a decryption module and a dedicated processor.
  • a dedicated processor is used to generate read instructions and send the read instructions to the access rights control module.
  • the decryption module is used to decrypt the AI model, and transmit the decrypted AI model to the dedicated processor, or transparently transmit the AI model to the dedicated processor; the dedicated processor is also used to execute the current AI model based on the AI model transmitted by the decryption module. computing tasks.
  • the model protection device further includes: a key generation module.
  • the key generation module is used to obtain the root key of the model protection device, the version ID of the AI model and the device ID of the model protection device, and generate a decryption key for decrypting the AI model based on the root key, version ID and device ID. key.
  • the model protection device further includes: a second register, where the second register is used to store the decryption key.
  • the decryption module is specifically configured to read the decryption key from the second register, and use the decryption key to decrypt the AI model.
  • the present application provides a model protection method.
  • the model protection method includes: a first computer device obtains a responsible party identifier and a root key of an artificial intelligence model; a third computer device obtains a model provided by a second computer device The device identification of the protection device, and the device identification of the model protection device is sent to the first computer equipment, the model protection device is deployed in the third computer equipment, and the model protection device is used to run the artificial intelligence model; the first computer equipment is allocated for the artificial intelligence model
  • the version identification according to the device identification of the model protection device, the version identification of the artificial intelligence model, and the root key, the encryption key of the artificial intelligence model is generated; the first computer equipment uses the encryption key to encrypt the artificial intelligence model, and sends it to the third computer equipment
  • the encrypted artificial intelligence model is sent, and the third computer device burns the encrypted artificial intelligence model into the non-volatile storage medium of the third computer device.
  • the encryption key is obtained according to the device ID, the root key and the version ID, when any one of the device ID, the root key and the version ID is different, the obtained encryption keys are different.
  • the device identifiers of different model protection devices are different, the encryption keys generated according to the device identifiers of different model protection devices are different, so different model protection devices can be used to protect different AI models.
  • the first computer device may generate a model manufacturer identification, and generate a root key according to the model manufacturer identification, so as to obtain the model manufacturer identification and the root key.
  • the first computer device may request the second computer device to assign a root key, and the second computer device may assign a model manufacturer identifier to the model manufacturer according to the request of the first computer device, and then generate a root key according to the model manufacturer identifier, and The root key and model manufacturer identification are sent to the first computer device.
  • the root key is generated according to the model manufacturer ID and the basic root key provided by the chip manufacturer.
  • the root key may be preset in a non-volatile storage medium of the model protection device.
  • the first computer device in order for the computing device of the terminal manufacturer to be able to decrypt the encrypted AI model, the first computer device also needs to send the responsible party identifier and the version identifier to the third computer device.
  • FIG. 1 is a schematic structural diagram of a computing device provided by an embodiment of the present application.
  • FIG. 2 is a schematic structural diagram of another computing device provided by an embodiment of the present application.
  • FIG. 3 is a schematic structural diagram of a model protection device provided by an embodiment of the present application.
  • FIG. 4 is a schematic structural diagram of a model protection device provided by an embodiment of the present application.
  • FIG. 5 is a schematic structural diagram of another computing device provided by an embodiment of the present application.
  • FIG. 6 is a schematic diagram of a read instruction being transmitted between a dedicated processor and a memory controller according to an embodiment of the present application
  • FIG. 7 is a flowchart of a method for an access authority controller to perform an authentication operation and to generate a control signal according to an authentication result according to an embodiment of the present application;
  • FIG. 8 is a flowchart of an encryption key for generating an AI model, and an encryption and decryption process for the AI model provided by an embodiment of the present application;
  • FIG. 9 is a schematic diagram of a process of information transmission in FIG. 8 provided by an embodiment of the present application.
  • FIG. 10 is a flowchart of a model protection method provided by an embodiment of the present application.
  • FIG. 11 is a schematic structural diagram of a computer device provided by an embodiment of the present application.
  • FIG. 13 is a flowchart of another model protection method provided by an embodiment of the present application.
  • AI models are very valuable and valuable intellectual property, and it is of great significance to protect them.
  • the risk of AI model being leaked and abused can be reduced, thereby guaranteeing the rights and interests of enterprises that invest in creating AI models.
  • the usage scenarios of the AI model generally involve the AI model, the special-purpose processor on which the AI model is implemented, and the computing device that uses the AI model to perform computing tasks.
  • the AI model relies on a dedicated processor means that the realization of the functions of the AI model needs to occupy the hardware resources in the dedicated processor.
  • a dedicated processor on which the AI model is implemented needs to be deployed in the computing device.
  • the AI model may be a computer program for implementing face recognition
  • the special-purpose processor may be a neural-network processing unit (NPU), which can implement the AI by using hardware in the neural-network processing unit.
  • NPU neural-network processing unit
  • the face recognition function of the model, the camera of the special processor is deployed in the computing device, and the camera can realize functions such as access control through the face recognition function.
  • computing tasks usually include multiple operations.
  • the computational tasks used for face recognition include: face detection, face key point location, face correction, face feature extraction, and feature comparison and other operations.
  • the AI model, dedicated processor and computing device are provided by at least two vendors.
  • the AI model is provided by the model manufacturer
  • the dedicated processor is provided by the chip manufacturer
  • the computing device is provided by the terminal manufacturer.
  • the dedicated processor can provide an interface, through which the AI model can cooperate with the hardware in the dedicated processor to realize the function of the AI model.
  • Terminal manufacturers can assemble special processors and other devices such as non-volatile storage media to obtain a computing device, and program the AI model into the non-volatile storage medium of the computing device, so that the computing device can use the computing device.
  • the AI model and this dedicated processor perform computational tasks.
  • the AI model and the dedicated processor are provided by the same manufacturer, and the computing device is provided by the terminal manufacturer. At this time, the terminal manufacturer assembles other devices such as a dedicated processor and a non-volatile storage medium to obtain a computing device, and program the AI model into the non-volatile storage medium of the computing device.
  • FIG. 1 is a schematic structural diagram of a computing device 0 according to an embodiment of the present application.
  • the computing device 0 includes: a driver module 10 , a memory 20 , a memory controller 301 and a dedicated processor 303 .
  • the driving module 10 is configured to receive the task request sent by the AI application, determine the AI model required by the task request according to the task request, and obtain the AI model from the non-volatile storage medium (not shown in FIG. 1 ) of the computing device 0, Then, apply for the memory 20 to the memory controller 301, store the data to be calculated carried by the AI model and the task request in the memory 20 allocated by the memory controller 301, and then send a task execution instruction to the dedicated processor 303 to instruct the dedicated processing The processor 303 executes the computing task requested by the task request.
  • the driver module 10 is usually implemented in software, and in an optional case, the driver module may also be referred to as a driver.
  • the task execution instruction is used to notify the dedicated processor 303 of task information such as the storage address of the data to be calculated in the memory 20 and the storage address of the AI model in the memory 20 .
  • the driving module 10 does not need to decrypt the AI model, and can directly store the AI model in the memory 20 .
  • the AI application may send a task request to the driving module 10 through an application programming interface (application programming interface, API).
  • the driving module 10 may be implemented by software.
  • the dedicated processor 303 is configured to obtain the data to be calculated and the AI model stored in the memory 20 according to the task execution instruction, use the AI model to perform a calculation task on the data to be calculated, and store the settlement result in the memory 20 .
  • the dedicated processor 303 needs to acquire the data to be calculated and the AI model stored in the memory 20, it can send a read instruction for requesting to read the AI model and a read instruction for requesting to read the data to be calculated to the memory controller 301 command, so that the memory controller 301 reads the AI model and the data to be calculated from the memory 20 , and sends the AI model and the data to be calculated to the dedicated processor 303 .
  • the computing device 0 shown in FIG. 1 when the AI model and the computing device 0 are provided by different manufacturers, if the AI model is not encrypted, the use of the AI model by the computing device 0 will not be effectively restricted. Therefore, in order to ensure the rights and interests of model manufacturers that provide AI models, it is urgent to protect the AI models provided by model manufacturers.
  • the embodiment of the present application provides a model protection device 30, the model protection device 30 can authenticate the operation of reading an AI model, and determine whether to perform an operation on the AI model read from the memory 20 according to the authentication result. Decryption is performed to control the process of decrypting the AI model, prevent the leakage and abuse of AI, and realize the protection of the AI model.
  • the model protector 30 may be deployed in the computing device 0 .
  • Embodiments of the present application provide a computing device.
  • the computing device 0 may be a camera, a desktop computer, a mobile phone, a tablet computer, a smart TV, a smart wearable device, an in-vehicle communication device, a computer, and the like.
  • FIG. 2 is a schematic structural diagram of another computing device 0 according to an embodiment of the present application.
  • the computing device 0 includes: a driver module 10, a memory 20 and a model protection device 30, and the model protection device 30 includes a memory controller 301, an access permission controller (APC) 302, and a dedicated processor 303.
  • the working process of the driving module 10 , the memory 20 and the dedicated processor 303 in the computing device 0 can be referred to the working process of the corresponding device in the computing device 0 in FIG. 1 , which will not be repeated here.
  • the driver module 10 notifies the dedicated processor 303 of the storage address of the data to be calculated in the memory 20 and the storage address of the AI model in the memory 20 through the task execution instruction, which can be implemented through a linked list node.
  • the task execution instruction may carry the address of the linked list node in the memory 20, and the linked list node stores the storage address of the AI model in the memory 20.
  • the dedicated processor 303 when it receives the task execution instruction, it will read the address of the linked list node in the memory 20, and then the dedicated processor 303 obtains the linked list node in the memory 20 according to the address of the linked list node in the memory 20, And obtain the storage address of the AI model in the memory 20 from the linked list node, and then obtain the AI model from the memory 20 according to the address obtained from the linked list node.
  • the linked list is a data structure, and the linked list includes a plurality of linked list nodes with logical order. Each linked list node consists of two parts: one is used to store the data field of the linked list node, and the other is used to indicate the link of the address of the next linked list node. In this embodiment of the present application, the data field of the linked list node is used to indicate the storage address of the AI model in the memory 20 .
  • the driver module 10 sends a task execution instruction to the special-purpose processor 303
  • the special-purpose processor 303 sends a task execution instruction to the special-purpose processor 303
  • the process of acquiring the data to be calculated and the AI model stored in the memory 20 can be implemented through a hardware queue.
  • the driver module 10 can write the task execution instruction into the hardware queue, and the task execution instruction written in the hardware queue will be queued in the hardware queue in order, when the execution timing of the computing task indicated by the task execution instruction arrives , the hardware queue sends a task execution instruction to the dedicated processor 303 .
  • the dedicated processor 303 After receiving the task execution instruction, the dedicated processor 303 sends a read instruction requesting to read the AI model from the memory 20 to the hardware queue.
  • the hardware queue sends a read command requesting to read the AI model from the memory 20 to the memory controller 301 .
  • the hardware queue is sent to the special-purpose processor 303, so that the special-purpose processor 303 uses the AI model to perform computing tasks on the data to be computed.
  • the operation of the special purpose processor 303 to start executing the computing task indicated by the task execution instruction may be triggered by a register.
  • this register is used to trigger the hardware queue to obtain the linked list node from the memory 20, and obtain the storage address of the AI model in the memory 20 from the linked list node, and send it to the dedicated processor 303 The acquired address is sent, so that the special-purpose processor 303 sends a read command according to the corresponding address.
  • the computing device 0 may further include a memory management unit (MMU) (not shown in FIG. 2 ), the memory manager is used for between the address carried by the request for accessing the memory and the physical address where the data is stored in the memory Perform address mapping.
  • MMU memory management unit
  • the memory controller 301 can be indirectly connected to the memory 20 through the memory manager, and the interaction between the memory controller 301 and the memory 20 can be realized through the memory manager.
  • this process can be regarded as a process in which the special-purpose processor 303 realizes reading the AI model from the memory 20 by sending a read command.
  • the special-purpose processor 303 when the driver module 10 sends a task execution instruction to the special-purpose processor 303, and the special-purpose processor 303 reads the data to be calculated and the AI model from the memory 20, when the process of reading the data to be calculated and the AI model from the memory 20 is not implemented through a hardware queue, the special-purpose processor 303 also needs to The memory controller 301 sends a read command to read the AI model from the memory 20 .
  • the special-purpose processor 303 sends a read command to the memory controller 301 to realize the process of reading the AI model from the memory 20, and does not distinguish whether there is a hardware queue or not, nor does it send a read command to the special-purpose processor 303. objects are distinguished.
  • the model protection device 30 includes: an access authority controller 302 and a memory controller 301 .
  • the access authority controller 302 is configured to acquire a read instruction, perform an authentication operation on the read instruction, generate a control signal based on the authentication result, and send the read instruction to the memory controller 301 .
  • the read instruction is used to request to read the AI model from the memory 20 .
  • the control signal is used to indicate whether to decrypt the AI model read from the memory 20 .
  • the control signal may include a first control signal and a second control signal. The first control signal is used to instruct to decrypt the AI model. The second control signal is used to indicate that the AI model is not decrypted.
  • the memory controller 301 is used to read the AI model from the memory 20 based on the read instruction.
  • the AI model in this embodiment of the present application may be a neural network model.
  • the access authority controller 302 authenticates the read instruction, and can generate an instruction whether to decrypt the AI model read from the memory 20.
  • the AI model is stored in the memory 20 in the form of an encrypted model
  • If the control signal indicates that the AI model is decrypted it is possible to use the AI model successfully. If the control signal indicates that the AI model is not decrypted, the AI model cannot be used. Therefore, in the access authority controller 302 provided in the embodiment of the present application, by controlling the process of decrypting the AI model, the leakage and abuse of the AI can be prevented, and the protection of the AI model can be achieved.
  • the model protection device 30 may further include: a decryption circuit 304 and a dedicated processor 303 .
  • the dedicated processor 303 is configured to generate a read instruction, and send the read instruction to the access authority controller 302, so that the access authority controller 302 can perform an authentication operation on the read instruction.
  • the driving module 10 stores the AI model and the data to be calculated in the memory 20
  • the driving module 10 can send a task execution instruction to the special-purpose processor 303 to instruct the special-purpose processor 303 to execute the computing task requested by the task request.
  • the dedicated processor 303 may generate a read instruction according to the task execution instruction, and send the read instruction to the access authority controller 302 .
  • the task execution instruction may carry the memory 20 address of the AI model in the memory 20, and correspondingly, the read instruction sent by the dedicated processor 303 may carry the memory 20 address.
  • the decryption circuit 304 is used to receive the control signal generated by the access authority controller 302, and under the instruction of the control signal, decrypt the AI model and transmit it to the dedicated processor 303, or, under the instruction of the control signal, to the dedicated processor. 303 Transparent AI model.
  • the decryption circuit 304 can use a decryption algorithm to decrypt the AI model.
  • the decryption algorithm used by the decryption circuit 304 may be a block cipher algorithm conforming to the International Organization for Standardization (ISO)/International Electrotechnical Commission (IEC) international standard.
  • the decryption algorithm used by the decryption circuit 304 may be an advanced encryption standard (AES) algorithm.
  • the dedicated processor 303 is also used for executing the current computing task based on the AI model transmitted by the decryption circuit 304 .
  • the dedicated processor 303 is specifically configured to run hardware such as circuits in the dedicated processor 303 to implement hardware acceleration of the AI model, so as to achieve the purpose of performing computing tasks based on the AI model.
  • the dedicated processor 303 may be a processor dedicated to performing AI calculations, for example, the dedicated processor 303 may be an NPU.
  • the access authority controller 302 can be mounted on the read channel where the dedicated processor 303 sends the read command to the memory controller 301 , and the decryption circuit 304 can be mounted on the read channel.
  • the memory controller 301 sends the read response to the special-purpose processor 303 on the response channel according to the read command.
  • the read command is used for requesting to read content such as data and computer programs, the read command is one of the read commands, and the read command is used to request to read the computer program.
  • the transmission path between the dedicated processor 303 and the memory controller 301 of the read instruction sent by the dedicated processor 303 is: firstly sent by the dedicated processor 303 to the access authority controller 302, and then sent by the access authority controller 302 to the memory controller 301 . Therefore, the access authority controller 302 can acquire the read command sent to the memory controller 301 and perform an authentication operation on the read command. In addition, the access authority controller 302 generates a control signal according to the authentication result of the read command, which can be sent to the memory controller 301 along with the read command.
  • the memory controller 301 can carry the AI model read according to the read instruction in the read response, and send the control signal to the decryption circuit 304 along with the read response, so that the decryption circuit 304 decrypts the AI according to the control signal, and sends it to the dedicated processor.
  • 303 sends the decrypted AI model, or the decryption circuit 304 transparently transmits the AI model to the dedicated processor 303 according to the control signal.
  • the access authority controller 302 can be mounted on the read channel through which the special purpose processor 303 sends commands or data to all other devices, so that the access authority controller 302 can obtain all commands and data sent by the special purpose processor 303 .
  • the access authority controller 302 may also classify the acquired commands and data, and perform an authentication operation on the read command sent to the memory controller 301 as a result of the classification.
  • the access authority controller 302 can be implemented in other ways, as long as the access authority controller 302 can obtain the read command sent by the dedicated processor 303, generate a control signal according to the authentication result of the read command, and send the control signal To the decryption circuit 304 for decrypting the AI model, and the AI model sent to the decryption circuit 304 and the control signal for indicating whether to decrypt the AI model may have a corresponding relationship.
  • the access authority controller 302 may not be mounted on the read channel through which the special-purpose processor 303 sends the read command to the memory controller 301.
  • the access authority control The device 302 sends the read instruction, and indicates that the AI model read according to the read instruction carries the identifier of the read instruction, and the control signal generated according to the read instruction carries the identifier of the read instruction, so as to pass the identifier of the read instruction.
  • the establishment of the AI model and the control signal used to indicate whether to decrypt the AI model which is not specifically limited in this embodiment of the present application.
  • the AI model sent to the decryption circuit 304 has a corresponding relationship with the control signal used to indicate whether to decrypt the AI model, so that the decryption circuit 304 can determine whether the AI has a corresponding relationship with the control signal according to the control signal.
  • the model is decrypted.
  • the indication function of the control signal on the decryption process can be realized by the value of the variable carried in the control signal.
  • the control signal when the value of the variable is 1, the control signal is used to instruct to decrypt the AI model read from the memory 20, and at this time, the control signal may be referred to as the first control signal.
  • the control signal When the value of the variable is 0, the control signal is used to indicate that the AI model read from the memory 20 is not to be decrypted. At this time, the control signal may be referred to as a second control signal.
  • control signal can be implemented in the form of an associated signal.
  • dashed arrow in FIG. 5 represents the transmission path of the control signal.
  • the memory controller 301 can send the control signal to the decryption device along with the AI model. circuit 304 .
  • the content indicated by the control signal can be represented by the value of the variable.
  • the memory controller 301 can carry the value of the variable in the control signal in the extension field in the data sent to the decryption circuit 304 , the indication function of the control signal is expressed by the value in the extension field.
  • the access authority controller 302 may obtain the read address for reading the AI model contained in the read instruction, and perform authentication on the read instruction based on the read address operate. For example, in addition to acquiring the read address for reading the AI model contained in the read instruction, the access authority controller 302 can also acquire the effective address range in the memory 20 of the AI model requested to be read by the read instruction, and according to the read address and The valid address range is used to authenticate the read command.
  • the effective address range of the AI model in the memory 20 at least covers the real storage address of the AI model in the memory 20 .
  • the effective address range of the AI model in the memory 20 may be set according to the storage address of the AI model in the memory 20 after the driver module 10 stores the AI model in the memory 20 .
  • the effective address range may be stored in registers.
  • the model protection device 30 may further include: a first register 305 , where the first register 305 is used to store the effective address range of the AI model in the memory 20 .
  • the first register 305 may be a general term for one or more registers used to store the effective address range.
  • the effective address range can be represented by variables stored in two registers, one of which is used to store the starting address of the effective address range, the other register is used to store the length of the effective address range, or another register is used to store the length of the effective address range. The ending address for storing this valid address range.
  • the implementation process of the access authority controller 302 generating the control signal according to the authentication result may include: when the read address is a legal address, the access authority controller 302 generates the first control signal; when the read address is illegal address, the access authority controller 302 generates a second control signal.
  • the read address when the read address is within the valid address range of the AI model, the read address is called a legal address, and when the read address is outside the valid address range of the AI model, the read address is called an illegal address.
  • the access authority controller 302 may also perform the authentication operation according to other conditions than the read address. For example, when the read address is a legal address and the specified condition is met, the access authority controller 302 generates a first control signal; when the read address is an illegal address, and/or when the specified condition is not met, the access authority controller 302 generates a second control signal control signal.
  • the specified condition includes at least one of the following: the decryption permission identifier indicates that the AI model used by the current computing task is allowed to be decrypted, or the AI model is an encryption model.
  • the decryption authority identifier is stored in the model protector 30 .
  • the decryption rights identification can be stored in a register.
  • the decryption permission identifier is used to indicate whether the AI model used by the current computing task is allowed to be decrypted.
  • the indication function of the decryption authority identifier can be determined by the value of the decryption authority identifier.
  • the decryption authority identifier when the value of the decryption authority identifier is 0, the decryption authority identifier is used to indicate that the AI model used by the current computing task is allowed to be decrypted, and when the value of the decryption authority identifier is 1, The decryption permission identifier is used to indicate that the AI model used by the current computing task is not allowed to be decrypted, and the default value of the decryption permission identifier is 0.
  • the access authority controller 302 may also set the decryption authority identifier according to whether the read address is a legal address.
  • the access authority controller 302 determines that the read address is an illegal address, it can control the decryption authority identifier to indicate that all AI models used by the current computing task are not allowed to be decrypted.
  • the penalty mechanism for decrypting the AI model can be realized by judging the read address, that is, once the read address is determined to be an illegal address, the decryption permission flag is set to indicate that all AI models used in the current computing task are Decryption is not allowed.
  • the penalty mechanism can set the decryption permission flag, so that the decryption permission flag indicates that all AI models used by the current computing task are not allowed to be decrypted, which can prevent the AI model from being attacked by this malicious model.
  • a decryption authority mark can be set for a plurality of computing tasks serially executed by the computing device 0, and the decryption authority mark is used in the The values during the execution of different computing tasks indicate whether the AI models used during the corresponding computing tasks are allowed to be decrypted.
  • decryption permission identifiers may be set for different computing tasks respectively, and the decryption permission identifier set for each computing task is used to indicate whether the AI model used by the corresponding computing task is allowed to be decrypted.
  • the access authority controller 302 can also reset the decryption authority identifier to indicate that decryption is permitted, so as to ensure that decryption is permitted.
  • the computing task executed after the current computing task can obtain the AI model normally.
  • the decryption authority identifier may also be reset in other ways.
  • the decryption authority identifier may be reset by re-powering on the computing device 0, which is not specifically limited in this embodiment of the present application.
  • Whether the AI model is an encrypted model can be determined by the value of the encrypted identifier of the AI model. In an implementation manner, when the value of the encryption identifier is 0, the encryption identifier is used to indicate that the AI model is an encrypted model, and when the value of the encryption identifier is 1, the encryption identifier is used to indicate that the AI model is a non-encrypted model. encryption model. Whether the AI model is an encrypted model can be determined according to the model manufacturer's protection requirements for the model. When the model manufacturer needs to protect the AI model, it can encrypt the AI model and set the encryption flag to indicate that the AI model is an encrypted model.
  • the encrypted identifier can be stored in a register, and the value of the encrypted identifier stored in the register can be set by the driving module 10 .
  • the drive module 10 After the drive module 10 writes the model into the non-volatile storage medium of the computing device 0, the drive module 10 can read the file header of the AI model, and the file header carries the model information covering the AI model, and the model information includes Indicates whether the model is an encrypted model and information such as the size of the model, and the driving module 10 can set the value of the encrypted identifier in the register according to the model information.
  • the dedicated processor 303 since the dedicated processor 303 needs to obtain the data to be calculated in addition to using the AI model when performing the calculation task, the dedicated processor 303 also sends a request to the memory controller 301 to request data from the memory 20 A read command to read data, etc. In addition, the read command needs to be transmitted to the memory controller 301 via the read channel through which the dedicated processor 303 sends the read command to the memory controller 301. Therefore, the access authority controller 302 will not only receive the read command for requesting to read the AI model, but also A read command for requesting to read data, etc. from the memory 20 is received.
  • the process of performing the authentication operation by the access authority controller 302 further includes: the access authority controller 302 determines whether the received read command is a read command, if the access authority controller 302 The received read command is not a read command, which means that the read command is not used to request to read the AI model from the memory 20, and the data read according to the read command does not need to be decrypted, then the access authority controller 302 can generate an instruction to indicate that the read command is not correct according to the read command.
  • a control signal that commands the decryption of the read content.
  • the read command carries a command identifier, and the command identifier is used to indicate the content requested by the read command. Then, according to the command identifier carried by the read command, it can be determined whether the read command is a read command for requesting to read the AI model.
  • the read address in the read command sent by the dedicated processor 303 is determined according to the memory 20 address in the memory 20 of the AI model that can be carried in the task execution instruction, and when the malicious program attacks the AI model, the malicious program will modify the
  • the AI model received by the dedicated processor 303 is at the memory 20 address in the memory 20, so that the read address carried by the read instruction sent by the dedicated processor 303 according to the memory 20 address is an illegal address.
  • the access authority controller 302 provided in this embodiment of the present application, the access authority controller 302 authenticates the read instruction, so that the read address sent by the dedicated processor 303 can be determined to be an illegal address, and a message indicating that the AI model is not to be decrypted can be generated.
  • the control signal makes the computing device 0 unable to use the encryption model, so that the abuse and attack of the AI model by malicious programs can be prevented.
  • the malicious program can not only modify the memory 20 address in the memory 20 of the AI model received by the special-purpose processor 303, but also modify the effective address range of the AI model stored in the first register 305.
  • the authority controller 302 will misjudge the read address as a legitimate address, but because the read address is a wrong address, the content read from the memory 20 according to the read address will not be the AI model originally required by the dedicated controller, but will be decrypted.
  • the decryption key provided by the circuit 304 is the decryption key of the originally required AI model. Therefore, the decryption key cannot be used to correctly decrypt the content read from the memory 20, which can still prevent malicious programs from attacking the AI model. .
  • the access authority controller 302 judges whether the read address is a legal address, the process of judging the content indicated by the decryption authority identifier, the process of judging whether the AI model is an encryption model, and the process of judging whether the received read command is a read command.
  • the execution order of the process can be set according to application requirements.
  • FIG. 7 shows a schematic diagram of a possible execution sequence. As shown in FIG. 7 , the access authority controller 302 performs an authentication operation, and the process of generating a control signal according to the authentication result includes the following steps:
  • Step 701 The access authority controller obtains a read command.
  • Step 702 After receiving the read command, the access authority controller determines whether the decryption authority identifier indicates that the AI model used by the current computing task is allowed to be decrypted. When the decryption authority identifier indicates that the AI model used by the current computing task is allowed to be decrypted, step 703 is executed. , when the decryption authority identifier indicates that the AI model used by the current computing task is not allowed to be decrypted, step 706 is executed.
  • Step 703 The access authority controller determines whether the AI model is an encrypted model. When the AI model is an encrypted model, step 704 is performed, and when the AI model is a non-encrypted model, step 706 is performed.
  • Step 704 The access authority controller determines whether the read command is a read command for instructing to read the AI model. When the read command is a read command for instructing to read the AI model, step 705 is executed. When the read command is not a read command for instructing When the read instruction of the AI model is read, step 706 is executed.
  • Step 705 The access authority controller judges whether the read address is a legal address, and when the read address is a legal address, generates a first control signal, and when the read address is an illegal address, controls the decryption authority identifier to indicate all AI models used by the current computing task Neither are allowed to be decrypted, and step 706 is executed.
  • Step 706 The access authority controller generates a second control signal.
  • the access authority controller when any one of the above judgment conditions is not satisfied, the access authority controller generates the second control signal, and there is no need to judge according to other judgment conditions, which can reduce the workload of the access authority controller and ensure the authentication efficiency.
  • the authentication process is first judged according to the above-mentioned decryption authority identifier, then judge whether the AI model is an encryption model, then judge whether the read command is a read command, and then judge whether the read address is a legal address, which can be based on the judgment conditions from coarse-grained. To achieve fine-grained judgment, the authentication efficiency can be further guaranteed.
  • the model protection device 30 may further include: a key generation circuit 306 .
  • the key generation circuit 306 is used to obtain the root key of the model protection device 30, the version identification of the AI model and the device identification of the model protection device 30, and based on the root key, the version identification and the device identification, generate a device for decrypting the AI model. decryption key.
  • the drive module 10 stores the AI model in the memory 20, it can send an instruction to the key generation circuit 306 to instruct to generate a decryption key, that is, the key generation circuit 306 is used to generate the decryption key under the instruction of the drive module 10. decryption key.
  • the process of generating the decryption key by the key generation circuit 306 may be generated before the AI model is stored in the memory 20 .
  • the key generation circuit 306 can generate a decryption key of the AI model for subsequent decryption and use.
  • the key generation circuit 306 in order to ensure that the AI model can be decrypted using the decryption key, the key generation circuit 306 generates a decryption key based on the root key, the version ID and the device ID.
  • the device identification and the implementation manner of generating the encryption key used to encrypt the AI model shall be consistent.
  • the algorithm for generating the decryption key and the algorithm for generating the encryption key may be the same.
  • the model protection device 30 further includes: a second register 307, and the second register 307 is used for storing the decryption key.
  • the decryption key may be stored in the second register 307 .
  • the decryption circuit 304 in the model protection device 30 is specifically configured to read the decryption key from the second register 307, and under the instruction of the control signal, use the read decryption key to decrypt the AI model.
  • the decryption circuit 304 decrypts the AI model, if the decryption key is the same as the encryption key used to encrypt the AI model, the decryption circuit 304 can use the decryption key to successfully decrypt the AI model. If the encryption key used to encrypt the model is different, the AI model cannot be decrypted.
  • the root key of the model protection device 30 and the device ID of the model protection device 30 are provided by the chip manufacturer
  • the version ID of the AI model is distributed by the model manufacturer
  • the operation of the model manufacturer is performed by the first computer equipment
  • the operation of the chip manufacturer is performed by the first computer device.
  • the second computer device performs the operation of the terminal manufacturer
  • the operation of the terminal manufacturer is performed by the third computer device.
  • the generation of the encryption key of the AI model and the implementation of the encryption and decryption process of the AI model are described.
  • the operation of the model maker may be performed by one or more computer devices, and the one or more computer devices may be collectively referred to as the first computer device.
  • the operations of the chip manufacturer may be performed by one or more computer devices, which are collectively referred to as second computer devices.
  • the operations of the terminal manufacturer may be performed by one or more computer devices, which are collectively referred to as third computer devices.
  • the implementation process includes the following steps:
  • Step 801 The first computer device acquires the model manufacturer ID of the AI model and the root key of the model protection device.
  • the first computer device may generate a model manufacturer identification, and generate a root key according to the model manufacturer identification, so as to obtain the model manufacturer identification and the root key.
  • the first computer device may request the second computer device to distribute a root key, and the second computer device may assign a model manufacturer identifier to a model manufacturer according to the request of the first computer device, and then generate a root key according to the model manufacturer identifier, and The root key and model manufacturer identification are sent to the first computer device.
  • the chip manufacturer is usually the trusted party of the model manufacturer. Therefore, as shown in Figure 9, the model manufacturer ID is usually assigned by the chip manufacturer to the model manufacturer, and the root key is usually based on the model manufacturer ID and the basic root provided by the chip manufacturer. key generation.
  • the root key and the model manufacturer identification can be sent to the first computer device in a packaged and encrypted manner.
  • the method of encrypting the model manufacturer ID and the root key may be a PGP (pretty good privacy) encryption method.
  • the process of generating the root key according to the model vendor identification can be performed offline using a server running in a secure environment.
  • the servers running in the secure environment may be hardware security modules (HSMs).
  • the root key may be preset in the non-volatile storage medium of the model protection device 30 .
  • the root key can be stored in a one-time programmable (OTP) storage medium. Since the OTP storage medium can only support writing data once, when a malicious program tampers with the root key stored in the OTP storage medium When the key is used, since the OTP storage medium cannot be written again, the security of the root key can be guaranteed.
  • OTP one-time programmable
  • Step 802 The third computer device acquires the device identifier of the model protection device, and sends the device identifier of the model protection device to the first computer device.
  • the model protection device 30 provided by the embodiment of the present application is deployed in the computing device 0 provided by the terminal manufacturer, and the model protection device 30 is used to implement the AI model.
  • the model protector 30 has a built-in device identifier, and the third computer device can read the device identifier of the model protector 30 through the application program interface on the model protector 30 and send the device identifier to the first computer device.
  • the device identification is the chip identification of the computing chip.
  • the device identification may be stored in a non-volatile storage medium of model protector 30 .
  • the device identifier can be stored in an OTP storage medium. Since the OTP storage medium can only support writing data once, when a malicious program tampers with the device identifier stored in the OTP storage medium, the OTP storage medium cannot be written again because the OTP storage medium cannot be written again. , so the security of the device identification can be guaranteed.
  • Step 803 The first computer device assigns a version identifier to the AI model, and generates an encryption key for the AI model according to the device identifier of the model protection device, the version identifier of the AI model, and the root key of the model protection device.
  • the model manufacturer may assign version identifiers to different AI models through the first computer device.
  • the model manufacturer can generate the encryption key of the AI model according to the acquired device ID, root key and version ID.
  • the chip manufacturer can provide the model manufacturer with a key generation unit for generating an encryption key, and the key generation unit can be implemented by software or hardware, and the model manufacturer can identify the version, device The identification and root key are input to the generation tool, and the output of the generation tool is received to obtain the encryption key of the AI model.
  • the key generation unit may first generate an intermediate key according to the root key and the version identifier, and then generate the encryption key according to the intermediate key and the device identifier.
  • the encryption key is obtained according to the device ID, the root key and the version ID, when any one of the device ID, the root key and the version ID is different, the obtained encryption keys are different.
  • the device identifiers of different model protectors 30 are different, the encryption keys generated according to the device identifiers of different model protectors 30 are different, so different model protectors 30 can be used to protect different AI models.
  • the same model protection device 30 is used to protect multiple AI models provided by the same model manufacturer, the encryption keys for controlling the multiple AI models can be the same or different according to the model manufacturer's wishes.
  • the model manufacturer can assign the same version identifier to the multiple AI models, and since the model manufacturer of the multiple AI models is the same, and the root key is Generated according to the model manufacturer identifiers of the AI models, that is, the device identifiers, version identifiers and root keys used to generate the encryption keys of the multiple AI models correspond to the same respectively, so the encryption keys of the multiple AI models are the same.
  • Step 804 the first computer equipment uses the encryption key to encrypt the AI model, sends the encrypted AI model to the third computer equipment, and sends the model manufacturer identification and version identification to the third computer equipment.
  • the first computer device After the first computer device obtains the encryption key of the AI model, it can use the encryption key to encrypt the AI model (also called the plaintext model) stored in plaintext, and purchase the AI model of the model manufacturer from the terminal manufacturer. After that, the encrypted AI model is sent to the terminal manufacturer.
  • the model manufacturer also needs to send the version identifier of the AI model and the model manufacturer identifier to the terminal manufacturer. Or, the model manufacturer sends the root key of the model protection device 30 and the AI model version identifier to the terminal manufacturer.
  • Step 805 The third computer device burns the encrypted AI model into the non-volatile storage medium of the computing device, and stores the model manufacturer ID and version ID in the non-volatile storage medium of the computing device.
  • the third computer device may program the encrypted AI model into the non-volatile storage medium of the computing device 0 .
  • the third computer device may burn the image file including the encrypted AI model into the non-volatile storage medium of the computing device 0 on the production line.
  • the model manufacturer ID and version ID are stored in the non-volatile storage medium of the computing device 0 .
  • the non-volatile storage medium may be a flash memory (flash memory), a hard disk drive (hard disk drive, HDD), or a solid-state drive (solid-state drive, SSD) or the like.
  • Step 806 The key generation circuit acquires the model manufacturer ID, version ID and device ID from the non-volatile storage medium of the computing device.
  • the third computer device can read the device identification and provide the key generation circuit 306 with the device identification.
  • the non-volatile storage medium of the computing device 0 stores the model manufacturer ID model_owner_id and the version ID, and the key generation circuit 306 can obtain the model manufacturer ID and version ID.
  • Step 807 The key generation circuit generates a decryption key according to the model manufacturer ID, version ID and device ID, and stores the decryption key in the second register.
  • the key generation circuit 306 can generate the root key of the model protector 30 according to the model manufacturer ID, and generate the decryption key according to the root key, the device ID of the model protector 30 and the version ID of the AI model .
  • the key generation circuit 306 since the key generation circuit 306 is provided by the chip manufacturer that provides the model protection device 30, the key generation circuit 306 can obtain the basic root key provided by the chip manufacturer, and obtain the basic root key provided by the chip manufacturer according to the model manufacturer ID and the chip manufacturer. The base root key provided by the manufacturer generates the root key.
  • the implementation manner of the key generation circuit 306 generating the decryption key needs to be consistent with the implementation manner of the first computer device to generate the encryption key.
  • the algorithm for generating the decryption key and the algorithm for generating the encryption key may be the same.
  • the key generation circuit may first generate an intermediate key according to the root key and the version identifier, and then generate the decryption key according to the intermediate key and the device identifier.
  • the process of generating the root key according to the model manufacturer ID, and then generating the decryption key according to the root key requires more execution than the process of directly generating the decryption key according to the root key.
  • One generation process can further ensure the security of the key.
  • the key generation circuit 306 can directly generate a decryption key according to the root key, version identifier and device identifier.
  • Step 808 The decryption circuit obtains the decryption key from the second register, and decrypts the encrypted AI model according to the decryption key.
  • the decryption operation can be performed on the encrypted AI model to obtain the plaintext model.
  • the dotted box in FIG. 9 represents an operation implemented by hardware or processed software, and its implementation logic cannot be intervened or tampered with by software
  • the solid-line box represents an operation implemented by software.
  • the processed software refers to processing such as curing the software so that the processed software cannot be interfered or tampered with.
  • the device ID and root key of the model protection device 30 cannot be tampered with. Therefore, the encryption key generated according to the root key and the device ID is used to use the encryption key pair.
  • the AI model can be protected to protect the AI model.
  • the actual form of the model protection device provided in the embodiments of the present application may be set according to application requirements.
  • the actual form of the model protection device may be a system on chip (system on chip, SOC), and the model protection device may be implemented by hardware such as a circuit.
  • the SoC may be a chip running in a safe environment (SE).
  • SE safe environment
  • the model protection device can be implemented by hardware or by a combination of hardware and software according to requirements.
  • the model protection device is implemented by hardware, since the logic implemented by the hardware cannot be changed after the hardware is manufactured, it can prevent terminal manufacturers or malicious programs from tampering with the implementation logic of the model protection device, thereby realizing the AI model. effective protection.
  • the software used to realize the model protection device can execute a specified means to ensure that the terminal manufacturer or malicious programs cannot tamper with the realization logic of the model protection device, thereby Achieve effective protection of AI models.
  • the functions implemented by the dedicated processor, the memory controller, the first register and the second register in the model protection device can be implemented by hardware
  • the access rights The functions implemented by the controller, the decryption circuit, and the key generation circuit can be implemented by software.
  • the function of the access authority controller is realized by the access authority control module
  • the function of the decryption circuit is realized by the decryption module
  • the function of the key generation circuit is realized by the key generation module
  • the functions of the above modules can all be executed by the processor. accomplish.
  • the access authority controller authenticates the read instruction, and can generate an indication whether to decrypt the AI model read from the memory.
  • the control signal indicates that the AI model is decrypted, it is possible to use the AI model successfully. If the control signal indicates that the AI model is not decrypted, the AI model cannot be used. Therefore, by controlling the process of decrypting the AI model, it can prevent the copying, leaking and misuse of AI, realize the protection of the AI model, help to establish a perfect AI model ecology, and build a safe and reasonable profit model.
  • a model protection device provided by the embodiment of the present application can be implemented on a single SOC, does not require additional SOC cost and the cost of interaction between different SOC chips, and can realize the security of the AI model at a lower cost.
  • Protect the protection of the AI model is realized by authenticating the read command, and a technology for checking the validity of the command is also provided, so that the embodiment of the present application can be applied to similar needs through the technology of checking the validity of the command. In scenarios where permission checks are performed.
  • the embodiment of the present application provides a model protection method.
  • the model protection method is applied to a model protection device, and the model protection device includes an access authority controller and a memory controller.
  • the model protection method can be applied to the aforementioned model protection device provided in the embodiments of the present application.
  • the access authority controller can obtain the read command, perform an authentication operation on the read command, generate a control signal based on the authentication result, and send the read command to the memory controller, and the memory controller can Read AI models in memory. In this way, the access authority controller can control the process of decrypting the AI model, preventing the leakage and abuse of the AI, and realizing the protection of the AI model.
  • model protection method includes:
  • Step 1001 the dedicated processor generates a read instruction, and sends the read instruction to the access authority controller.
  • Step 1002 the access authority controller obtains the read address for reading the AI model included in the read instruction, performs an authentication operation on the read instruction based on the read address, generates a control signal based on the authentication result, and sends the read instruction to the memory controller .
  • the control signal includes a first control signal and a second control signal, the first control signal is used to instruct the AI model to be decrypted, and the second control signal is used to instruct not to decrypt the AI model.
  • the access authority controller generates a control signal based on the authentication result, including: when the read address is a legal address, the access authority controller generates a first control signal; when the read address is an illegal address, the access authority The controller generates the second control signal.
  • the control signal includes a first control signal and a second control signal
  • the first control signal is used to instruct the AI model to be decrypted
  • the second control signal is used to instruct not to decrypt the AI model
  • the model is protected.
  • a decryption authority identifier is stored in the device, and the decryption authority identifier is used to indicate whether the AI model used by the current computing task is allowed to be decrypted.
  • the access authority controller generates a control signal based on the authentication result, including: when the read address is a legal address and meets the specified conditions When , the access authority controller generates a first control signal; when the read address is an illegal address, and/or when the specified condition is not met, the access authority controller generates a second control signal.
  • the specified condition includes at least one of the following: the decryption permission identifier indicates that the AI model used by the current computing task is allowed to be decrypted; or, the AI model is an encryption model.
  • the model protection device further includes: a first register, where the first register is used to store the effective address range of the AI model in the memory, and the access authority controller performs an authentication operation on the read instruction, including: the access authority controller starts from the first register.
  • a valid address range is read from a register, and an authentication operation is performed on the read command based on the valid address range and the read address.
  • the model protection method further includes: when the read address is an illegal address, the access authority controller controls the decryption authority identifier to indicate that all AI models used by the current computing task are Decryption is not allowed.
  • the model protection method further includes: after completing the current computing task, the access authority controller resets the decryption authority identifier to indicate that decryption is permitted.
  • Step 1003 the memory controller reads the AI model from the memory based on the read instruction, and provides the AI model to the decryption circuit.
  • Step 1004 The decryption circuit receives the control signal generated by the access authority controller, and under the instruction of the control signal, decrypts the AI model and transmits it to the dedicated processor, or, under the instruction of the control signal, transparently transmits it to the dedicated processor AI model.
  • the model protection device further includes: a key generation circuit.
  • the model protection method further includes: the key generation circuit obtains the root key of the model protection device, the version identification of the AI model and the device identification of the model protection device, and based on the root key, the version identification and the device identification, generates a method for performing the execution of the AI model. Decrypted decryption key.
  • the model protection device further includes: a second register, where the second register is used to store a decryption key, and after the access authority controller generates a control signal based on the authentication result, the model protection method further includes: decryption in the model protection device The circuit reads the decryption key from the second register, and uses the decryption key to decrypt the AI model under the instruction of the control signal.
  • the drive module 10 after the drive module 10 stores the AI model in the memory 20, it can send an instruction to the key generation circuit 306 to instruct to generate a decryption key, that is, the operation of the key generation circuit to generate the decryption key is under the instruction of the drive module 10 start execution.
  • the process of generating the decryption key by the key generation circuit 306 may be generated before the AI model is stored in the memory 20 .
  • the key generation circuit 306 can generate a decryption key of the AI model for subsequent decryption and use.
  • Step 1005 The dedicated processor executes the current computing task based on the AI model transmitted by the decryption circuit.
  • the read instruction is authenticated by the access authority controller, and an indication of whether to decrypt the AI model read from the memory can be generated.
  • the control signal indicates that the AI model is decrypted, it is possible to use the AI model successfully. If the control signal indicates that the AI model is not decrypted, the AI model cannot be used. Therefore, by controlling the process of decrypting the AI model, it can prevent the copying, leaking and misuse of AI, realize the protection of the AI model, help to establish a perfect AI model ecology, and build a safe and reasonable profit model.
  • a model protection device provided by the embodiment of the present application can be implemented on a single SOC, does not require additional SOC cost and the cost of interaction between different SOC chips, and can realize the security of the AI model at a lower cost.
  • Protect the protection of the AI model is realized by authenticating the read command, and a technology for checking the validity of the command is also provided, so that the embodiment of the present application can be applied to similar needs through the technology of checking the validity of the command. In scenarios where permission checks are performed.
  • the embodiments of the present application provide a computer device.
  • the computer device 1100 includes a processor 1110 , a communication interface 1120 and a memory 1130 .
  • the processor 1110 , the communication interface 1120 and the memory 1130 are connected to each other through a bus 1140 .
  • a computer program is stored in the memory 1130 .
  • the processor 1110 executes the computer program, the computer device implements the foregoing model protection method provided by the embodiments of the present application.
  • the bus 1140 can be divided into an address bus, a data bus, a control bus, and the like. For ease of presentation, only one thick line is used in FIG. 11, but it does not mean that there is only one bus or one type of bus.
  • the memory 1130 may include volatile memory, such as random-access memory (RAM).
  • RAM random-access memory
  • the memory 1130 may also include non-volatile memory (non-volatile memory) such as flash memory (flash memory), hard disk drive (HDD) or solid-state drive (SSD).
  • flash memory flash memory
  • HDD hard disk drive
  • SSD solid-state drive
  • Memory 1130 may also include a combination of the above-described types of memory.
  • the processor 1110 may be a hardware chip, and is configured to implement the model protection method provided by the embodiments of the present application.
  • the hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD) or a combination thereof.
  • the above-mentioned PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a general-purpose array logic (generic array logic, GAL) or any combination thereof.
  • the processor 1110 may also be a general-purpose processor, such as a central processing unit (CPU), a network processor (NP), or a combination of CPU and NP.
  • the memory 1130 is used to store program instructions, and the processor 1110 invokes the program instructions stored in the memory 1130 to execute one or more steps in the model protection method provided by the embodiments of the present application, or optional implementations therein.
  • the computer device 1100 implements the model protection method provided by the above method embodiments.
  • the processor 1110 invokes the program instructions stored in the memory 1120, and the computer device 1100 can perform the following steps performed by the access authority controller: acquiring the read address for reading the AI model contained in the read instruction, and performing the read address based on the read address.
  • the instruction performs an authentication operation, generates a control signal based on the authentication result, and sends the read instruction to the memory controller.
  • the implementation process of executing this step may refer to the corresponding description in the foregoing embodiments.
  • the communication interface 1130 may be any one or any combination of the following devices: a network interface (eg, an Ethernet interface), a wireless network card, and other devices with a network access function.
  • An embodiment of the present application provides a computer-readable storage medium, which may be a non-transitory readable storage medium, and stores instructions in the computer-readable storage medium. When the instructions are executed by a processor, the computer It is used to execute the foregoing model protection method provided by the embodiments of the present application.
  • the storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, a data center, etc. that includes one or more available mediums integrated.
  • the available media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVDs), or semiconductor media (eg, SSDs).
  • the present application also provides a computer program product, where the computer program product includes computer instructions, and when executed by a computer device, the computer device executes the aforementioned model protection method provided by the embodiments of the present application.
  • the embodiment of the present application also provides another model protection device, the model protection device can authenticate the operation of reading the AI model, and determine whether to read the AI model from the memory according to the authentication result, so as to pass the AI model It can control the reading process of AI, prevent the leakage and abuse of AI, and realize the protection of AI model.
  • the model protector may be deployed in a computing device.
  • Embodiments of the present application provide a computing device.
  • the computing device may be a camera, a desktop computer, a mobile phone, a tablet computer, a smart TV, a smart wearable device, an in-vehicle communication device, a computer, and the like.
  • FIG. 2 for a schematic structural diagram of the computing device.
  • the computing device 0 includes a driver module 10 , a memory 20 and a model protection device 30
  • the model protection device 30 includes a memory controller 301 , an access authority controller 302 and a dedicated processor 303 .
  • the working process of the driving module 10 , the memory 20 and the dedicated processor 303 in the computing device 0 corresponds to the working process of the corresponding device in the computing device 0 in the previous embodiment, and will not be repeated here.
  • the model protection device 30 includes: an access authority controller 302 and a memory controller 301 .
  • the access authority controller 302 is configured to acquire a read instruction, perform an authentication operation on the read instruction, generate a read instruction signal based on the authentication result, and send the read instruction signal and the read instruction to the memory controller 301 .
  • the read indication signal is used to indicate whether the AI model is allowed to be read from the memory 20 .
  • the memory controller 301 is configured to read the AI model from the memory 20 based on the read instruction under the instruction of the read instruction signal, or not perform the operation of reading the AI model from the memory 20 based on the read instruction under the instruction of the read instruction signal.
  • the read indication signal includes a first read indication signal and a second read indication signal.
  • the first read indication signal is used to indicate that the AI model is allowed to be read from the memory 20 .
  • the second read indication signal is used to indicate that the AI model is not allowed to be read from the memory 20 .
  • the access authority controller 302 is configured to generate a first read instruction signal when the authentication of the read instruction is passed, and generate a second read instruction signal when the authentication of the read instruction fails.
  • the read indication signal is also used to indicate whether to decrypt the AI model read from the memory 20 .
  • the access authority controller 302 is further configured to send the read instruction signal to the decryption circuit 304 of the model protection device 30, so that the decryption circuit 304 can perform corresponding operations under the instruction of the read instruction signal.
  • the first read indication signal is used to indicate that the AI model is allowed to be read from the memory 20 and the AI model read from the memory 20 is allowed to be decrypted.
  • the second read instruction signal is used to indicate that the AI model is not allowed to be read from the memory 20, and the AI model read from the memory 20 is not allowed to be decrypted.
  • the model protection device 30 includes: an access authority controller 302 and a memory controller 301 .
  • the access authority controller 302 is configured to acquire the read command, perform an authentication operation on the read command, and determine whether to send the read command to the memory controller 301 based on the authentication result.
  • the access authority controller 302 is configured to send the read command to the memory controller 301 when the authentication of the read command is passed, so that the memory controller 301 can read the AI model from the memory 20 based on the read command;
  • the read command is intercepted, so that the memory controller 301 cannot receive the read command, so that the AI model requested by the read command cannot be read from the memory 20 .
  • the access authority controller 302 is specifically configured to: acquire a read address for reading the AI model included in the read instruction, and perform an authentication operation on the read instruction based on the read address.
  • the access authority controller 302 is specifically configured to: when the read address is a legal address, determine that the authentication of the read instruction has passed, and when the read address is an illegal address, It is determined that the authentication of the read command fails.
  • the model protection device 30 stores a decryption authority identifier, and the decryption authority identifier is used to indicate whether the AI model used by the current computing task is allowed to be decrypted, and the access authority controller 302 is specifically used for: when the read address is a legal address and the specified condition is met, determine that the authentication of the read instruction is passed; when the read address is an illegal address, and/or, when the specified condition is not met, determine the authentication of the read instruction Fail.
  • the specified condition includes at least one of the following: the decryption permission identifier indicates that the AI model used by the current computing task is allowed to be decrypted, or the AI model is an encryption model.
  • the access authority controller 302 is further configured to: when the read address is an illegal address, control the decryption authority identifier to indicate that all AI models used by the current computing task are not allowed to be decrypted.
  • the access authority controller 302 is further configured to reset the decryption authority identifier to indicate that decryption is permitted after the current computing task is completed.
  • the model protection device 30 further includes: a first register 305, where the first register 305 is used to store the effective address range of the AI model in the memory 20; correspondingly, the access authority controller 302 specifically uses In order to read the effective address range from the first register 305, an authentication operation is performed on the read command based on the effective address range and the read address.
  • the model protection device 30 further includes: a decryption circuit 304 and a dedicated processor 303 .
  • the dedicated processor 303 is used to generate a read command and send the read command to the access rights controller 302 .
  • the decryption circuit 304 is used to decrypt the AI model, and transmit the decrypted AI model to the special-purpose processor 303 , or transparently transmit the AI model to the special-purpose processor 303 .
  • the dedicated processor 303 is also used for executing the current computing task based on the AI model transmitted by the decryption circuit 304 .
  • the model protection device 30 further includes: a key generation circuit 306 ; the key generation circuit 306 is used to obtain the root key of the model protection device 30 , the version identifier of the AI model and the Device ID, based on the root key, version ID, and device ID, to generate a decryption key for decrypting the AI model.
  • the model protection device 30 further includes: a second register 307 .
  • the second register 307 is used to store the decryption key.
  • the decryption circuit 304 in the model protection device 30 is specifically configured to read the decryption key from the second register 307, and use the decryption key to decrypt the AI model.
  • the read command is authenticated by the access authority controller, and according to the authentication result, it is controlled whether to read the read command from the memory according to the read command.
  • AI model when the AI model is stored in the memory in the form of an encrypted model, if the authentication is passed, the AI model can be read from the memory, and it is possible to use the AI model successfully. Read the AI model, the AI model cannot be used. Therefore, by controlling the process of reading the AI model from the memory, it can prevent the copying, leakage and abuse of AI, realize the protection of the AI model, help to establish a perfect AI model ecology, and build a safe and reasonable profit model .
  • a model protection device provided by the embodiment of the present application can be implemented on a single SOC, does not require additional SOC cost and the cost of interaction between different SOC chips, and can realize the security of the AI model at a lower cost.
  • Protect the protection of the AI model is realized by authenticating the read command, and a technology for checking the validity of the command is also provided, so that the embodiment of the present application can be applied to similar needs through the technology of checking the validity of the command. In scenarios where permission checks are performed.
  • the embodiment of the present application provides a model protection method.
  • the model protection method is applied to a model protection device, and the model protection device includes an access authority controller and a memory controller.
  • the model protection method can be applied to the aforementioned model protection device provided in the embodiments of the present application.
  • the access authority controller can obtain a read instruction, perform an authentication operation on the read instruction, and control whether the memory controller reads the AI model from the memory based on the authentication result. In this way, the access authority controller can control the process of reading the AI model from the memory, prevent the leakage and abuse of the AI, and realize the protection of the AI model.
  • the model protection method includes:
  • Step 1201 The dedicated processor generates a read instruction, and sends the read instruction to the access authority controller.
  • Step 1202 the access authority controller obtains the read address for reading the AI model contained in the read instruction, performs an authentication operation on the read instruction based on the read address, generates a read instruction signal based on the authentication result, and compares the read instruction signal with the read instruction signal.
  • the read command is sent to the memory controller.
  • the read indication signal includes a first read indication signal and a second read indication signal.
  • the first read indication signal is used to instruct the AI model to be read from the memory.
  • the second read indication signal is used to instruct not to read the AI model from the memory.
  • the access authority controller is configured to generate a first read instruction signal when the authentication of the read instruction is passed, and generate a second read instruction signal when the authentication of the read instruction fails.
  • the access authority controller performs an authentication operation on the read instruction, including: when the read address is a legal address, determining that the authentication of the read instruction is passed, and when the read address is an illegal address, determining The authentication of the read command failed.
  • the access authority controller performs an authentication operation on the read instruction, including: when the read address is a legal address and meets a specified condition, determining that the authentication of the read instruction is passed; when the read address is If the address is illegal, and/or the specified condition is not met, it is determined that the authentication of the read command fails.
  • the specified condition includes at least one of the following: the decryption permission identifier indicates that the AI model used by the current computing task is allowed to be decrypted, or the AI model is an encryption model.
  • Step 1203 Under the instruction of the read instruction signal, the memory controller reads the AI model from the memory based on the read instruction, and provides the AI model to the decryption circuit, or, under the instruction of the read instruction signal, does not execute the read instruction from the memory based on the read instruction. Take the operation of the AI model.
  • Step 1204 The decryption circuit decrypts the AI model, and transmits the decrypted AI model to the dedicated processor, or transparently transmits the AI model to the dedicated processor.
  • Step 1205 The dedicated processor executes the current computing task based on the AI model transmitted by the decryption circuit.
  • model protection method includes:
  • Step 1301 The dedicated processor generates a read instruction, and sends the read instruction to the access authority controller.
  • Step 1302 The access authority controller obtains the read address for reading the AI model included in the read instruction, performs an authentication operation on the read instruction based on the read address, and determines whether to send the read instruction to the memory controller based on the authentication result.
  • the access authority controller sends the read instruction to the memory controller when the authentication of the read instruction passes, and then executes step 1303, so that the memory controller can read the AI model from the memory based on the read instruction;
  • the read instruction is intercepted, so that the memory controller cannot receive the read instruction, so that the AI model requested by the read instruction cannot be read from the memory, and the model based on the read instruction ends this time. process of protection.
  • Step 1303 The memory controller reads the AI model from the memory based on the read instruction, and provides the AI model to the decryption circuit.
  • Step 1304 The decryption circuit decrypts the AI model, and transmits the decrypted AI model to the dedicated processor, or transparently transmits the AI model to the dedicated processor.
  • Step 1305 The dedicated processor executes the current computing task based on the AI model transmitted by the decryption circuit.
  • the read instruction is authenticated by the access authority controller, and according to the authentication result, it is controlled whether to read the request to read the read instruction from the memory according to the read instruction.
  • AI model when the AI model is stored in the memory in the form of an encrypted model, if the authentication is passed, the AI model can be read from the memory, and it is possible to use the AI model successfully. Read the AI model, the AI model cannot be used. Therefore, by controlling the process of reading the AI model from the memory, it can prevent the copying, leakage and abuse of AI, realize the protection of the AI model, help to establish a perfect AI model ecology, and build a safe and reasonable profit model .
  • a model protection device provided by the embodiment of the present application can be implemented on a single SOC, does not require additional SOC cost and the cost of interaction between different SOC chips, and can realize the security of the AI model at a lower cost.
  • Protect the protection of the AI model is realized by authenticating the read command, and a technology for checking the validity of the command is also provided, so that the embodiment of the present application can be applied to similar needs through the technology of checking the validity of the command. In scenarios where permission checks are performed.
  • the embodiments of the present application provide a computer device.
  • the computer device includes a processor, a communication interface and a memory.
  • the processor, the communication interface and the memory are connected to each other through a bus.
  • a computer program is stored in the memory.
  • the processor executes the computer program, the computer device implements the foregoing model protection method provided by the embodiments of the present application.
  • the implementation manner and structure of the computer device please refer to the corresponding content of the aforementioned computer device provided in the embodiments of the present application.
  • An embodiment of the present application provides a computer-readable storage medium, which may be a non-transitory readable storage medium, and stores instructions in the computer-readable storage medium. When the instructions are executed by a processor, the computer It is used to execute the foregoing model protection method provided by the embodiments of the present application.
  • the storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, a data center, etc. that includes one or more available mediums integrated.
  • the available media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVDs), or semiconductor media (eg, SSDs).
  • the present application also provides a computer program product, where the computer program product includes computer instructions, and when executed by a computer device, the computer device executes the aforementioned model protection method provided by the embodiments of the present application.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Storage Device Security (AREA)

Abstract

A model protection device (30), a method, and a computing device, related to the technical field of artificial intelligence. The model protection device (30) comprises: an access permission controller (302) and a memory controller (301). The access permission controller (302) is used for acquiring a read instruction. The read instruction is used for requesting to read an artificial intelligence (AI) model from a memory. The access permission controller (302) is also used for executing an authentication operation with respect to the read instruction and generating a control signal on the basis of the authentication result. The control signal is used for indicating whether to decrypt the AI model read from the memory. The access permission controller (302) is also used for transmitting the read instruction to the memory controller (301). The memory controller (301) is used for reading the AI model from the memory on the basis of the read instruction. The model protection device (30) prevents the copying, disclosure, and abuse of AI, thus implementing the protection of the AI model.

Description

模型保护装置及方法、计算装置Model protection device and method, computing device 技术领域technical field
本申请涉及人工智能(artificial intelligence,AI)技术领域,特别涉及一种模型保护装置及方法、计算装置。The present application relates to the technical field of artificial intelligence (AI), and in particular, to a model protection device and method, and a computing device.
背景技术Background technique
随着人工智能技术的快速发展,越来越多的应用场景中使用AI模型解决问题。AI模型是非常宝贵且极具价值的知识产权,对其进行保护具有重要意义。With the rapid development of artificial intelligence technology, more and more application scenarios use AI models to solve problems. AI models are very valuable and valuable intellectual property, and it is of great significance to protect them.
目前,主要通过合同等法律手段对AI模型进行保护,以防止AI模型的泄露和滥用,在技术上对AI模型进行保护尚无有效方案。At present, AI models are mainly protected by legal means such as contracts to prevent the leakage and abuse of AI models, and there is no effective solution to technically protect AI models.
发明内容SUMMARY OF THE INVENTION
本申请提供了一种模型保护装置及方法、计算装置,能够对AI模型进行保护,本申请提供的技术方案如下:The application provides a model protection device and method, and a computing device, which can protect the AI model. The technical solutions provided by the application are as follows:
第一方面,本申请提供了一种模型保护装置,该模型保护装置包括:访问权限控制器和内存控制器。该访问权限控制器用于获取读指令,读指令用于请求从内存中读取人工智能AI模型。该访问权限控制器还用于对读指令执行鉴权操作,并基于鉴权结果生成控制信号,控制信号用于指示是否对从内存中读取的AI模型进行解密。该访问权限控制器还用于将读指令发送至内存控制器。且内存控制器用于基于读指令从内存中读取AI模型。In a first aspect, the present application provides a model protection device, where the model protection device includes: an access authority controller and a memory controller. The access authority controller is used to obtain a read command, and the read command is used to request to read the artificial intelligence AI model from the memory. The access authority controller is also used to perform an authentication operation on the read instruction, and generate a control signal based on the authentication result, where the control signal is used to indicate whether to decrypt the AI model read from the memory. The access rights controller is also used to send read commands to the memory controller. And the memory controller is used to read the AI model from the memory based on the read instruction.
通过访问权限控制器对读指令进行鉴权,能够生成指示是否对从内存中读取的AI模型进行解密,当该AI模型以加密模型的形式存储在内存中时,若控制信号指示对该AI模型进行解密,才有可能成功使用该AI模型,若控制信号指示不对该AI模型进行解密,则无法使用该AI模型。因此,通过对AI模型进行解密的过程进行控制,能够防止AI的拷贝、泄露和滥用,实现对该AI模型的保护,有助于建立完善的AI模型生态,构筑安全合理的盈利模式。The read command is authenticated by the access authority controller, and an indication of whether to decrypt the AI model read from the memory can be generated. When the AI model is stored in the memory in the form of an encrypted model, if the control signal indicates that the AI Only after the model is decrypted can the AI model be successfully used. If the control signal indicates that the AI model is not decrypted, the AI model cannot be used. Therefore, by controlling the process of decrypting the AI model, it can prevent the copying, leaking and misuse of AI, realize the protection of the AI model, help to establish a perfect AI model ecology, and build a safe and reasonable profit model.
可选地,访问权限控制器具体用于:获取读指令中包含的用于读取AI模型的读地址,基于读地址对读指令执行鉴权操作。例如,除了获取读指令中包含的用于读取AI模型的读地址,访问权限控制器还可以获取读指令请求读取的AI模型在内存中的有效地址范围,并根据该读地址和该有效地址范围,执行对读指令的鉴权操作。其中,AI模型在内存中的有效地址范围至少覆盖AI模型在内存中的真实存储地址。AI模型在内存中的有效地址范围可以是驱动模块将AI模型存储在内存中之后,根据AI模型在内存中的存储地址设置的。Optionally, the access authority controller is specifically configured to: acquire a read address for reading the AI model included in the read instruction, and perform an authentication operation on the read instruction based on the read address. For example, in addition to obtaining the read address for reading the AI model contained in the read command, the access authority controller can also obtain the valid address range in the memory of the AI model read by the read command, and according to the read address and the valid address range Address range, perform the authentication operation on the read command. Among them, the effective address range of the AI model in the memory at least covers the real storage address of the AI model in the memory. The effective address range of the AI model in the memory may be set according to the storage address of the AI model in the memory after the driver module stores the AI model in the memory.
其中,控制信号包括第一控制信号和第二控制信号,第一控制信号用于指示对AI模型进行解密,第二控制信号用于指示不对AI模型进行解密。The control signal includes a first control signal and a second control signal, the first control signal is used to instruct the AI model to be decrypted, and the second control signal is used to instruct not to decrypt the AI model.
在一种可实现方式中,访问权限控制器具体用于:当读地址为合法地址时,生成第一控制信号;当读地址为非法地址时,生成第二控制信号。其中,当读地址位于AI模型的有效地址范围内时,该读地址称为合法地址,当读地址位于AI模型的有效地址范围外时,该读地址称为非法地址。In an implementation manner, the access authority controller is specifically configured to: generate a first control signal when the read address is a legal address; and generate a second control signal when the read address is an illegal address. Among them, when the read address is within the valid address range of the AI model, the read address is called a legal address, and when the read address is outside the valid address range of the AI model, the read address is called an illegal address.
在另一种可实现方式中,访问权限控制器还可以根据除读地址外的其他条件执行鉴权操 作。例如,模型保护装置中存储有解密权限标识,解密权限标识用于指示当前计算任务使用的AI模型是否允许被解密,相应的,访问权限控制器具体用于:当读地址为合法地址且满足指定条件时,生成第一控制信号;当读地址为非法地址,和/或,不满足指定条件时,生成第二控制信号。其中,指定条件包括以下至少一个:解密权限标识指示当前计算任务使用的AI模型允许被解密,或,AI模型为加密模型。In another implementation manner, the access authority controller may also perform the authentication operation according to other conditions than the read address. For example, a decryption authority identifier is stored in the model protection device, and the decryption authority identifier is used to indicate whether the AI model used by the current computing task is allowed to be decrypted. Correspondingly, the access authority controller is specifically used for: when the read address is a legal address and meets the specified requirements When the condition is met, the first control signal is generated; when the read address is an illegal address, and/or the specified condition is not met, the second control signal is generated. The specified condition includes at least one of the following: the decryption permission identifier indicates that the AI model used by the current computing task is allowed to be decrypted, or the AI model is an encryption model.
可选地,访问权限控制器还可以根据读地址是否为合法地址,对解密权限标识进行设置。在一种可实现方式中,访问权限控制器确定读地址为非法地址时,可以控制解密权限标识指示当前计算任务使用的所有AI模型均不允许被解密。这样一来,能够通过对读地址的判断,实现对AI模型进行解密的惩罚机制,即一旦确定读地址为非法地址,则对解密权限标识进行设置,以指示当前计算任务使用的所有AI模型都不允许被解密。当通过恶意模型对需要保护的AI模型进行攻击时,通常需要先从内存中读出该恶意模型,而请求读取该恶意模型的读指令携带的读地址不是合法地址,此时,通过该惩罚机制能够对解密权限标识进行设置,使得解密权限标识指示当前计算任务使用的所有AI模型均不允许被解密,能够防止通过该恶意模型对AI模型进行攻击。Optionally, the access authority controller may also set the decryption authority identifier according to whether the read address is a legal address. In an implementation manner, when the access authority controller determines that the read address is an illegal address, it can control the decryption authority identifier to indicate that all AI models used by the current computing task are not allowed to be decrypted. In this way, the penalty mechanism for decrypting the AI model can be realized by judging the read address, that is, once the read address is determined to be an illegal address, the decryption permission flag is set to indicate that all AI models used in the current computing task are Decryption is not allowed. When attacking an AI model that needs to be protected through a malicious model, it is usually necessary to read the malicious model from the memory first, and the read address carried by the read instruction requesting to read the malicious model is not a legal address. In this case, the penalty is passed. The mechanism can set the decryption permission flag, so that the decryption permission flag indicates that all AI models used by the current computing task are not allowed to be decrypted, which can prevent the AI model from being attacked by the malicious model.
并且,由于该解密权限标识用于指示当前计算任务使用的AI模型是否允许被解密,因此,可以为计算装置串行执行的多个计算任务设置一个解密权限标识,并通过该解密权限标识在不同计算任务的执行过程中的取值指示对应计算任务过程中使用的AI模型是否允许被解密。或者,也可以为不同计算任务分别设置解密权限标识,为每个计算任务设置的解密权限标识用于指示对应的计算任务使用的AI模型是否允许被解密。In addition, since the decryption authority identifier is used to indicate whether the AI model used by the current computing task is allowed to be decrypted, a decryption authority identifier can be set for multiple computing tasks serially executed by the computing device, and the decryption authority identifier can be used in different computing tasks. The value during the execution of the computing task indicates whether the AI model used during the corresponding computing task is allowed to be decrypted. Alternatively, decryption permission identifiers may be set for different computing tasks respectively, and the decryption permission identifier set for each computing task is used to indicate whether the AI model used by the corresponding computing task is allowed to be decrypted.
相应的,当为计算装置串行执行的多个计算任务设置一个解密权限标识时,在完成当前计算任务后,访问权限控制器还可以将解密权限标识重置为指示允许解密,以保证在当前计算任务后面执行的计算任务能够正常获取AI模型。可选地,还可以通过其他方式对解密权限标识进行重置,例如,可以通过对计算装置进行重新上电,实现对解密权限标识的重置。Correspondingly, when a decryption authority identifier is set for a plurality of computing tasks performed serially by the computing device, after completing the current computing task, the access authority controller may also reset the decryption authority identifier to indicate that decryption is permitted, so as to ensure that the The computing task executed after the computing task can obtain the AI model normally. Optionally, the decryption authority identifier can also be reset in other ways, for example, the decryption authority identifier can be reset by re-powering on the computing device.
AI模型是否为加密模型,可以根据模型厂商对模型的保护需求确定。当模型厂商需要对AI模型进行保护时,可以对AI模型加密,并设置加密标识指示AI模型为加密模型。当模型厂商不需要对AI模型进行保护时,则无需对AI模型加密,并设置加密标识指示AI模型为非加密模型。Whether the AI model is an encrypted model can be determined according to the model manufacturer's protection requirements for the model. When the model manufacturer needs to protect the AI model, it can encrypt the AI model and set the encryption flag to indicate that the AI model is an encrypted model. When the model manufacturer does not need to protect the AI model, it does not need to encrypt the AI model, and set the encryption flag to indicate that the AI model is a non-encrypted model.
在一种可实现方式中,访问权限控制器执行鉴权操作的过程还包括:该访问权限控制器判断接收的读命令是否为读指令,若访问权限控制器接收的读命令不是读指令,表示该读命令不用于请求从内存中读取AI模型,根据该读命令读取的数据无需解密,则访问权限控制器可以生成用于指示不对根据该读命令读取的内容进行解密的控制信号。其中,读命令用于请求读取数据和计算机程序等内容,读指令为读命令中的一种,读指令用于请求读取计算机程序。In an implementation manner, the process of performing the authentication operation by the access authority controller further includes: the access authority controller judges whether the received read command is a read command, and if the read command received by the access authority controller is not a read command, indicating The read command is not used to request to read the AI model from the memory, and the data read according to the read command does not need to be decrypted, and the access authority controller can generate a control signal for instructing not to decrypt the content read according to the read command. The read command is used for requesting to read content such as data and computer programs, the read command is one of the read commands, and the read command is used to request to read the computer program.
需要说明的是,访问权限控制器判断读地址是否为合法地址的过程、判断解密权限标识指示的内容的过程、判断AI模型是否为加密模型的过程、及判断接收的读命令是否为读指令的过程的执行顺序可以根据应用需求进行设置。It should be noted that the process of judging whether the read address is a legal address by the access authority controller, the process of judging the content indicated by the decryption authority identifier, the process of judging whether the AI model is an encryption model, and the process of judging whether the received read command is a read command. The execution order of the procedures can be set according to the application requirements.
在一种可实现方式中,访问权限控制器执行鉴权操作,并根据鉴权结果生成控制信号的过程包括:访问权限控制器获取读命令;访问权限控制器接收到读命令后,判断解密权限标识指示当前计算任务使用的AI模型是否允许被解密,当解密权限标识指示当前计算任务使用 的AI模型不允许被解密时,访问权限控制器生成第二控制信号;当解密权限标识指示当前计算任务使用的AI模型允许被解密时,访问权限控制器判断AI模型是否为加密模型,当AI模型为非加密模型时,访问权限控制器生成第二控制信号,当AI模型为加密模型时,访问权限控制器判断读命令是否为用于指示读取AI模型的读指令,当读命令不是用于指示读取AI模型的读指令时,访问权限控制器生成第二控制信号,当读命令为用于指示读取AI模型的读指令时,访问权限控制器判断读地址是否为合法地址,当读地址为合法地址时,生成第一控制信号,当读地址为非法地址时,控制解密权限标识指示当前计算任务使用的所有AI模型均不允许被解密,访问权限控制器生成第二控制信号。In an implementation manner, the process of the access authority controller performing the authentication operation and generating the control signal according to the authentication result includes: the access authority controller obtains a read command; after the access authority controller receives the read command, the access authority controller determines the decryption authority The identifier indicates whether the AI model used by the current computing task is allowed to be decrypted. When the decryption authority identifier indicates that the AI model used by the current computing task is not allowed to be decrypted, the access authority controller generates a second control signal; when the decryption authority identifier indicates the current computing task When the AI model used is allowed to be decrypted, the access authority controller determines whether the AI model is an encrypted model. When the AI model is a non-encrypted model, the access authority controller generates a second control signal. When the AI model is an encrypted model, the access authority The controller judges whether the read command is a read command for instructing to read the AI model, and when the read command is not a read command for instructing to read the AI model, the access authority controller generates a second control signal, when the read command is for When instructing to read the read command of the AI model, the access authority controller determines whether the read address is a legal address, and when the read address is a legal address, a first control signal is generated, and when the read address is an illegal address, the control decryption authority identifier indicates the current address. All AI models used by computing tasks are not allowed to be decrypted, and the access rights controller generates a second control signal.
其中,当以上任意一个判断条件不满足时,访问权限控制器生成第二控制信号,则无需根据其他判断条件进行判断,能够减小访问权限控制器的工作量,保证鉴权效率。并且,当鉴权过程按照上述先根据解密权限标识进行判断,再判断AI模型是否为加密模型,再判断读命令是否为读指令,再判断读地址是否为合法地址,能够根据判断条件从粗粒度到细粒度实现判断,能够进一步保证鉴权可靠性。Wherein, when any one of the above judgment conditions is not satisfied, the access authority controller generates the second control signal, and there is no need to judge according to other judgment conditions, which can reduce the workload of the access authority controller and ensure the authentication efficiency. In addition, when the authentication process is first judged according to the above-mentioned decryption authority identifier, then judge whether the AI model is an encryption model, then judge whether the read command is a read command, and then judge whether the read address is a legal address, which can be based on the judgment conditions from coarse-grained. To achieve fine-grained judgment, it can further ensure the reliability of authentication.
可选地,模型保护装置还包括:第一寄存器,第一寄存器用于存储AI模型在内存中的有效地址范围。访问权限控制器具体用于从第一寄存器中读取有效地址范围,基于有效地址范围和读地址对读指令执行鉴权操作。Optionally, the model protection device further includes: a first register, where the first register is used to store the effective address range of the AI model in the memory. The access authority controller is specifically configured to read the effective address range from the first register, and perform an authentication operation on the read instruction based on the effective address range and the read address.
在一种可实现方式中,该第一寄存器可以为用于实现存储有效地址范围的一个或多个寄存器的统称。例如,有效地址范围可以通过两个寄存器中存储的变量表示,其中一个寄存器用于存储该有效地址范围的起始地址,另一个寄存器用于存储该有效地址范围的长度,或者,另一个寄存器用于存储该有效地址范围的终止地址。In an implementation manner, the first register may be a collective term for one or more registers used to implement the storage effective address range. For example, the effective address range can be represented by variables stored in two registers, one register for storing the starting address of the effective address range and the other register for storing the length of the effective address range, or the other register with to store the end address of the valid address range.
可选地,模型保护装置还包括:解密电路和专用处理器。专用处理器用于生成读指令,并将读指令发送至访问权限控制器。解密电路用于接收访问权限控制器生成的控制信号,并在控制信号的指示下,对AI模型进行解密后传输给专用处理器,或者,在控制信号的指示下,向专用处理器透传AI模型。专用处理器还用于基于解密电路传输的AI模型,执行当前计算任务。Optionally, the model protection device further includes: a decryption circuit and a dedicated processor. A dedicated processor is used to generate read commands and send them to the access rights controller. The decryption circuit is used to receive the control signal generated by the access authority controller, and under the instruction of the control signal, decrypt the AI model and transmit it to the dedicated processor, or, under the instruction of the control signal, transparently transmit the AI to the dedicated processor Model. Dedicated processors are also used to perform current computing tasks based on the AI model transmitted by the decryption circuit.
并且,模型保护装置还包括:密钥生成电路。密钥生成电路用于获取模型保护装置的根密钥、AI模型的版本标识和模型保护装置的装置标识,基于根密钥、版本标识和装置标识,生成用于对AI模型进行解密的解密密钥。In addition, the model protection device further includes: a key generation circuit. The key generation circuit is used to obtain the root key of the model protection device, the version ID of the AI model and the device ID of the model protection device, and based on the root key, version ID and device ID, generate a decryption key for decrypting the AI model. key.
其中,为了保证能够使用该解密密钥对AI模型进行解密,该密钥生成电路基于根密钥、版本标识和装置标识生成解密密钥的实现方式,需要与基于根密钥、版本标识和装置标识,生成用于对AI模型进行加密的加密密钥的实现方式保持一致。例如,生成解密密钥的算法和生成加密密钥的算法可以相同。Among them, in order to ensure that the AI model can be decrypted using the decryption key, the key generation circuit generates a decryption key based on the root key, version ID and device ID. Identity, the implementation of generating the encryption key used to encrypt the AI model remains consistent. For example, the algorithm for generating the decryption key and the algorithm for generating the encryption key may be the same.
进一步的,模型保护装置还包括:第二寄存器。第二寄存器用于存储解密密钥。相应的,模型保护装置中的解密电路具体用于从第二寄存器中读取解密密钥,在控制信号的指示下,采用解密密钥对AI模型解密。Further, the model protection device further includes: a second register. The second register is used to store the decryption key. Correspondingly, the decryption circuit in the model protection device is specifically configured to read the decryption key from the second register, and under the instruction of the control signal, use the decryption key to decrypt the AI model.
其中,解密电路对AI模型进行解密时,若解密密钥与对AI模型进行加密的加密密钥相同,则解密电路能够使用解密密钥对AI模型成功解密,若解密密钥与对AI模型进行加密的加密密钥不同,则无法实现对AI模型的解密。Among them, when the decryption circuit decrypts the AI model, if the decryption key is the same as the encryption key used to encrypt the AI model, the decryption circuit can use the decryption key to successfully decrypt the AI model. If the encrypted encryption keys are different, the AI model cannot be decrypted.
第二方面,本申请提供了一种计算装置,该计算装置包括:内存和如第一方面以及其任 一种可能的实现方式中提供的模型保护装置。In a second aspect, the present application provides a computing device, the computing device comprising: a memory and the model protection device provided in the first aspect and any possible implementation manner thereof.
可选地,计算装置还包括驱动模块,该驱动模块用于接收AI应用程序发送的任务请求,根据任务请求确定任务请求所需的AI模型,从计算装置的非易失性存储介质中获取该AI模型,然后,向内存控制器申请内存,并将AI模型和任务请求携带的待计算数据存储在内存控制器分配的内存中,再向专用处理器发送任务执行指示,以指示专用处理器执行任务请求所请求执行的计算任务。其中,任务执行指示用于通知专用处理器待计算数据在内存中的存储地址和AI模型在内存中的存储地址等任务信息。相应的,专用处理器用于在接收该任务执行指示后发送读指令。Optionally, the computing device further includes a drive module, the drive module is used to receive the task request sent by the AI application, determine the AI model required by the task request according to the task request, and obtain the AI model from the non-volatile storage medium of the computing device. The AI model then applies for memory from the memory controller, stores the data to be calculated carried by the AI model and the task request in the memory allocated by the memory controller, and sends a task execution instruction to the dedicated processor to instruct the dedicated processor to execute The computational task requested by the task request to be performed. The task execution instruction is used to notify the dedicated processor of task information such as the storage address of the data to be calculated in the memory and the storage address of the AI model in the memory. Correspondingly, the dedicated processor is configured to send a read instruction after receiving the task execution instruction.
第三方面,本申请提供了一种模型保护方法。该模型保护方法应用于模型保护装置。模型保护装置包括:访问权限控制器和内存控制器。该模型保护方法包括:访问权限控制器获取读指令,读指令用于请求从内存中读取人工智能AI模型;访问权限控制器对读指令执行鉴权操作,并基于鉴权结果生成控制信号,控制信号用于指示是否对从内存中读取的AI模型进行解密;访问权限控制器将读指令发送至内存控制器;内存控制器基于读指令从内存中读取AI模型。In a third aspect, the present application provides a model protection method. The model protection method is applied to a model protection device. The model protection device includes: an access authority controller and a memory controller. The model protection method includes: an access authority controller obtains a read instruction, and the read instruction is used to request to read an artificial intelligence AI model from a memory; the access authority controller performs an authentication operation on the read instruction, and generates a control signal based on the authentication result, The control signal is used to indicate whether to decrypt the AI model read from the memory; the access authority controller sends the read command to the memory controller; the memory controller reads the AI model from the memory based on the read command.
可选地,访问权限控制器对读指令执行鉴权操作,包括:访问权限控制器获取读指令中包含的用于读取AI模型的读地址,基于读地址对读指令执行鉴权操作。Optionally, the access authority controller performs an authentication operation on the read instruction, including: the access authority controller obtains a read address for reading the AI model included in the read instruction, and performs an authentication operation on the read instruction based on the read address.
可选地,控制信号包括第一控制信号和第二控制信号,第一控制信号用于指示对AI模型进行解密,第二控制信号用于指示不对AI模型进行解密,访问权限控制器基于鉴权结果生成控制信号,包括:当读地址为合法地址时,访问权限控制器生成第一控制信号;当读地址为非法地址时,访问权限控制器生成第二控制信号。Optionally, the control signal includes a first control signal and a second control signal, the first control signal is used to instruct the AI model to be decrypted, the second control signal is used to instruct not to decrypt the AI model, and the access authority controller is based on authentication. As a result, the control signal is generated, including: when the read address is a legal address, the access authority controller generates a first control signal; when the read address is an illegal address, the access authority controller generates a second control signal.
可选地,控制信号包括第一控制信号和第二控制信号,第一控制信号用于指示对AI模型进行解密,第二控制信号用于指示不对AI模型进行解密,模型保护装置中存储有解密权限标识,解密权限标识用于指示当前计算任务使用的AI模型是否允许被解密,访问权限控制器基于鉴权结果生成控制信号,包括:当读地址为合法地址且满足指定条件时,访问权限控制器生成第一控制信号;当读地址为非法地址,和/或,不满足指定条件时,访问权限控制器生成第二控制信号。其中,指定条件包括以下至少一个:解密权限标识指示当前计算任务使用的AI模型允许被解密;或,AI模型为加密模型。Optionally, the control signal includes a first control signal and a second control signal, the first control signal is used to instruct the AI model to be decrypted, the second control signal is used to instruct not to decrypt the AI model, and the decryption device is stored in the model protection device. Authority identifier, the decryption authority identifier is used to indicate whether the AI model used by the current computing task is allowed to be decrypted. The access authority controller generates a control signal based on the authentication result, including: when the read address is a legal address and meets the specified conditions, the access authority control The controller generates a first control signal; when the read address is an illegal address and/or does not meet a specified condition, the access authority controller generates a second control signal. The specified condition includes at least one of the following: the decryption permission identifier indicates that the AI model used by the current computing task is allowed to be decrypted; or, the AI model is an encryption model.
可选地,在访问权限控制器对读指令执行鉴权操作之后,模型保护方法还包括:当读地址为非法地址时,访问权限控制器控制解密权限标识指示当前计算任务使用的所有AI模型均不允许被解密。Optionally, after the access authority controller performs an authentication operation on the read instruction, the model protection method further includes: when the read address is an illegal address, the access authority controller controls the decryption authority identifier to indicate that all AI models used by the current computing task are Decryption is not allowed.
可选地,在访问权限控制器对读指令执行鉴权操作之后,模型保护方法还包括:在完成当前计算任务后,访问权限控制器将解密权限标识重置为指示允许解密。Optionally, after the access authority controller performs an authentication operation on the read instruction, the model protection method further includes: after completing the current computing task, the access authority controller resets the decryption authority identifier to indicate that decryption is permitted.
可选地,模型保护装置还包括:第一寄存器,第一寄存器用于存储AI模型在内存中的有效地址范围,访问权限控制器对读指令执行鉴权操作,包括:访问权限控制器从第一寄存器中读取有效地址范围,基于有效地址范围和读地址对读指令执行鉴权操作。Optionally, the model protection device further includes: a first register, where the first register is used to store the effective address range of the AI model in the memory, and the access authority controller performs an authentication operation on the read instruction, including: the access authority controller starts from the first register. A valid address range is read from a register, and an authentication operation is performed on the read command based on the valid address range and the read address.
可选地,模型保护装置还包括:解密电路和专用处理器,在访问权限控制器获取读指令之前,模型保护方法还包括:专用处理器生成读指令,并将读指令发送至访问权限控制器;在访问权限控制器基于鉴权结果生成控制信号之后,模型保护方法还包括:解密电路接收访问权限控制器生成的控制信号,并在控制信号的指示下,对AI模型进行解密后传输给专用处 理器,或者,在控制信号的指示下,向专用处理器透传AI模型;专用处理器基于解密电路传输的AI模型,执行当前计算任务。Optionally, the model protection device further includes: a decryption circuit and a dedicated processor. Before the access authority controller acquires the read instruction, the model protection method further includes: the dedicated processor generates a read instruction and sends the read instruction to the access authority controller. After the access authority controller generates the control signal based on the authentication result, the model protection method further includes: the decryption circuit receives the control signal generated by the access authority controller, and under the instruction of the control signal, decrypts the AI model and transmits it to the dedicated The processor, or, under the instruction of the control signal, transparently transmits the AI model to the dedicated processor; the dedicated processor executes the current computing task based on the AI model transmitted by the decryption circuit.
可选地,模型保护装置还包括:密钥生成电路。模型保护方法还包括:密钥生成电路获取模型保护装置的根密钥、AI模型的版本标识和模型保护装置的装置标识,基于根密钥、版本标识和装置标识,生成用于对AI模型进行解密的解密密钥。Optionally, the model protection device further includes: a key generation circuit. The model protection method further includes: the key generation circuit obtains the root key of the model protection device, the version identification of the AI model and the device identification of the model protection device, and based on the root key, the version identification and the device identification, generates a method for performing the execution of the AI model. Decrypted decryption key.
可选地,模型保护装置还包括:第二寄存器,第二寄存器用于存储解密密钥,在访问权限控制器基于鉴权结果生成控制信号之后,模型保护方法还包括:模型保护装置中的解密电路从第二寄存器中读取解密密钥,在控制信号的指示下,采用解密密钥对AI模型解密。Optionally, the model protection device further includes: a second register, where the second register is used to store a decryption key, and after the access authority controller generates a control signal based on the authentication result, the model protection method further includes: decryption in the model protection device The circuit reads the decryption key from the second register, and uses the decryption key to decrypt the AI model under the instruction of the control signal.
第四方面,本申请提供了一种计算机设备,该计算机设备包括:处理器和存储器,存储器中存储有计算机程序。处理器执行计算机程序时,计算机设备实现第三方面以及其任一种可能的实现方式中提供的模型保护方法。In a fourth aspect, the present application provides a computer device, the computer device includes: a processor and a memory, and a computer program is stored in the memory. When the processor executes the computer program, the computer device implements the model protection method provided in the third aspect and any possible implementation manner thereof.
第五方面,本申请提供了一种计算机可读存储介质,该计算机可读存储介质中存储有指令,当该指令被处理器执行时,实现第三方面以及其任一种可能的实现方式中提供的模型保护方法。In a fifth aspect, the present application provides a computer-readable storage medium, where instructions are stored in the computer-readable storage medium, and when the instructions are executed by a processor, the third aspect and any possible implementation manner thereof are implemented. Provided model protection method.
第六方面,本申请提供了一种模型保护装置,模型保护装置用于获取读指令,对读指令执行鉴权操作,并基于鉴权结果控制是否从内存中读出AI模型。In a sixth aspect, the present application provides a model protection device. The model protection device is used to obtain a read command, perform an authentication operation on the read command, and control whether to read an AI model from a memory based on the authentication result.
通过访问权限控制器对读指令进行鉴权,并根据鉴权结果控制是否根据读指令从内存中读取读指令请求读取的AI模型,当该AI模型以加密模型的形式存储在内存中时,若鉴权通过才能够从内存中读取AI模型,才有可能成功使用该AI模型,若鉴权不通过无法从内存中读取AI模型,则无法使用该AI模型。因此,通过对从内存中读取AI模型的过程进行控制,能够防止AI的拷贝、泄露和滥用,实现对该AI模型的保护,有助于建立完善的AI模型生态,构筑安全合理的盈利模式。The read command is authenticated by the access authority controller, and according to the authentication result, it is controlled whether to read the AI model requested by the read command from the memory according to the read command. When the AI model is stored in the memory in the form of an encrypted model If the AI model can be read from the memory only after the authentication is passed, it is possible to use the AI model successfully. If the AI model cannot be read from the memory after the authentication is not passed, the AI model cannot be used. Therefore, by controlling the process of reading the AI model from the memory, it can prevent the copying, leakage and abuse of AI, realize the protection of the AI model, help to establish a perfect AI model ecology, and build a safe and reasonable profit model .
在一种可实现方式中,该模型保护装置包括:访问权限控制器和内存控制器。访问权限控制器用于获取读指令,对读指令执行鉴权操作,基于鉴权结果生成读指示信号,并将该读指示信号和读指令发送至内存控制器。该读指示信号用于指示是否从内存中读取AI模型。内存控制器用于在读指示信号的指示下,基于读指令从内存中读取AI模型,或者,在读指示信号的指示下,不执行基于读指令从内存中读取AI模型的操作。In an implementation manner, the model protection device includes: an access authority controller and a memory controller. The access authority controller is used to acquire a read instruction, perform an authentication operation on the read instruction, generate a read instruction signal based on the authentication result, and send the read instruction signal and the read instruction to the memory controller. The read indication signal is used to indicate whether to read the AI model from memory. The memory controller is used to read the AI model from the memory based on the read instruction under the instruction of the read instruction signal, or, under the instruction of the read instruction signal, not to perform the operation of reading the AI model from the memory based on the read instruction.
其中,读指示信号包括第一读指示信号和第二读指示信号。第一读指示信号用于指示从内存中读出AI模型。第二读指示信号用于指示不从内存中读出AI模型。相应的,访问权限控制器用于在对读指令的鉴权通过时,生成第一读指示信号,在对读指令的鉴权不通过时,生成第二读指示信号。The read indication signal includes a first read indication signal and a second read indication signal. The first read indication signal is used to instruct the AI model to be read from the memory. The second read indication signal is used to instruct not to read the AI model from the memory. Correspondingly, the access authority controller is configured to generate a first read instruction signal when the authentication of the read instruction is passed, and generate a second read instruction signal when the authentication of the read instruction fails.
在另一种可实现方式中,模型保护装置包括:访问权限控制器和内存控制器。访问权限控制器用于获取读指令,对读指令执行鉴权操作,基于鉴权结果确定是否向内存控制器发送读指令。可选地,访问权限控制器用于在对读指令的鉴权通过时,将读指令发送至内存控制器,以便于内存控制器基于该读指令从内存中读出AI模型;在对读指令的鉴权不通过时,对读指令进行拦截,使得内存控制器无法接收到该读指令,从而无法从内存中读取该读指令请求读取的AI模型。In another implementation manner, the model protection device includes: an access authority controller and a memory controller. The access authority controller is used to acquire the read command, perform an authentication operation on the read command, and determine whether to send the read command to the memory controller based on the authentication result. Optionally, the access authority controller is used to send the read command to the memory controller when the authentication of the read command is passed, so that the memory controller can read the AI model from the memory based on the read command; When the authentication fails, the read command is intercepted, so that the memory controller cannot receive the read command, so that the AI model requested by the read command cannot be read from the memory.
在访问权限控制器鉴权的一种可实现方式中,访问权限控制器具体用于:当读地址为合法地址时,确定对读指令的鉴权通过,当读地址为非法地址时,确定对读指令的鉴权不通过。 其中,当读地址位于AI模型的有效地址范围内时,该读地址称为合法地址,当读地址位于AI模型的有效地址范围外时,该读地址称为非法地址。In an implementation manner of the authentication of the access authority controller, the access authority controller is specifically used to: when the read address is a legal address, determine that the authentication of the read instruction is passed, and when the read address is an illegal address, determine the The authentication of the read command failed. Among them, when the read address is within the valid address range of the AI model, the read address is called a legal address, and when the read address is outside the valid address range of the AI model, the read address is called an illegal address.
在访问权限控制器鉴权的另一种可实现方式中,模型保护装置中存储有解密权限标识,解密权限标识用于指示当前计算任务使用的AI模型是否允许被解密,访问权限控制器具体用于:当读地址为合法地址且满足指定条件时,确定对读指令的鉴权通过;当读地址为非法地址,和/或,不满足指定条件时,确定对读指令的鉴权不通过。其中,指定条件包括以下至少一个:解密权限标识指示当前计算任务使用的AI模型允许被解密,或,AI模型为加密模型。In another possible implementation of authentication by the access authority controller, the model protection device stores a decryption authority identifier, and the decryption authority identifier is used to indicate whether the AI model used by the current computing task is allowed to be decrypted. In: when the read address is a legal address and meets the specified conditions, it is determined that the authentication of the read command is passed; when the read address is an illegal address, and/or the specified conditions are not met, it is determined that the authentication of the read command fails. The specified condition includes at least one of the following: the decryption permission identifier indicates that the AI model used by the current computing task is allowed to be decrypted, or the AI model is an encryption model.
第七方面,本申请提供了一种计算装置,该计算装置包括:内存和如第六方面以及其任一种可能的实现方式中提供的模型保护装置。In a seventh aspect, the present application provides a computing device, the computing device comprising: a memory and the model protection device provided in the sixth aspect and any possible implementation manner thereof.
第八方面,本申请提供了一种模型保护方法。该模型保护方法应用于模型保护装置。模型保护装置包括:访问权限控制器和内存控制器。该模型保护方法包括:获取读指令,对读指令执行鉴权操作,并基于鉴权结果控制内存控制器是否从内存中读出AI模型。In an eighth aspect, the present application provides a model protection method. The model protection method is applied to a model protection device. The model protection device includes: an access authority controller and a memory controller. The model protection method includes: acquiring a read instruction, performing an authentication operation on the read instruction, and controlling whether the memory controller reads out the AI model from the memory based on the authentication result.
在一种可实现方式中,该模型保护方法包括:访问权限控制器获取读指令,对读指令执行鉴权操作,基于鉴权结果生成读指示信号,并将该读指示信号和读指令发送至内存控制器。该读指示信号用于指示是否从内存中读取AI模型。内存控制器在读指示信号的指示下,基于读指令从内存中读取AI模型,或者,在读指示信号的指示下,不执行基于读指令从内存中读取AI模型的操作。In an implementation manner, the model protection method includes: the access authority controller obtains a read instruction, performs an authentication operation on the read instruction, generates a read indication signal based on the authentication result, and sends the read indication signal and the read instruction to a memory controller. The read indication signal is used to indicate whether to read the AI model from memory. Under the instruction of the read instruction signal, the memory controller reads the AI model from the memory based on the read instruction, or, under the instruction of the read instruction signal, does not perform the operation of reading the AI model from the memory based on the read instruction.
其中,读指示信号包括第一读指示信号和第二读指示信号。第一读指示信号用于指示从内存中读出AI模型。第二读指示信号用于指示不从内存中读出AI模型。相应的,访问权限控制器用于在对读指令的鉴权通过时,生成第一读指示信号,在对读指令的鉴权不通过时,生成第二读指示信号。The read indication signal includes a first read indication signal and a second read indication signal. The first read indication signal is used to instruct the AI model to be read from the memory. The second read indication signal is used to instruct not to read the AI model from the memory. Correspondingly, the access authority controller is configured to generate a first read instruction signal when the authentication of the read instruction is passed, and generate a second read instruction signal when the authentication of the read instruction fails.
在另一种可实现方式中,模型保护方法包括:访问权限控制器获取读指令,对读指令执行鉴权操作,基于鉴权结果确定是否向内存控制器发送读指令。可选地,访问权限控制器在对读指令的鉴权通过时,将读指令发送至内存控制器,以便于内存控制器基于该读指令从内存中读出AI模型;在对读指令的鉴权不通过时,对读指令进行拦截,使得内存控制器无法接收到该读指令,从而无法从内存中读取该读指令请求读取的AI模型。In another implementation manner, the model protection method includes: the access authority controller obtains a read instruction, performs an authentication operation on the read instruction, and determines whether to send the read instruction to the memory controller based on the authentication result. Optionally, when the authentication of the read instruction is passed, the access authority controller sends the read instruction to the memory controller, so that the memory controller can read the AI model from the memory based on the read instruction; When the right is not passed, the read command is intercepted, so that the memory controller cannot receive the read command, so that the AI model requested by the read command cannot be read from the memory.
在一种可实现方式中,访问权限控制器对读指令执行鉴权操作,包括:当读地址为合法地址时,确定对读指令的鉴权通过,当读地址为非法地址时,确定对读指令的鉴权不通过。In an achievable manner, the access authority controller performs an authentication operation on the read instruction, including: when the read address is a legal address, determining that the authentication of the read instruction is passed, and when the read address is an illegal address, determining that the read instruction is authenticated. The authentication of the command failed.
可选地,模型保护装置中存储有解密权限标识,解密权限标识用于指示当前计算任务使用的AI模型是否允许被解密,访问权限控制器对读指令执行鉴权操作,包括:当读地址为合法地址且满足指定条件时,确定对读指令的鉴权通过;当读地址为非法地址,和/或,不满足指定条件时,确定对读指令的鉴权不通过。其中,指定条件包括以下至少一个:解密权限标识指示当前计算任务使用的AI模型允许被解密,或,AI模型为加密模型。Optionally, a decryption authority identifier is stored in the model protection device, and the decryption authority identifier is used to indicate whether the AI model used by the current computing task is allowed to be decrypted, and the access authority controller performs an authentication operation on the read instruction, including: when the read address is When the address is legal and the specified conditions are met, it is determined that the authentication of the read instruction is passed; when the read address is an illegal address, and/or the specified conditions are not met, it is determined that the authentication of the read instruction fails. The specified condition includes at least one of the following: the decryption permission identifier indicates that the AI model used by the current computing task is allowed to be decrypted, or the AI model is an encryption model.
第九方面,本申请提供了一种计算机设备,该计算机设备包括:处理器和存储器,存储器中存储有计算机程序。处理器执行计算机程序时,计算机设备实现第八方面以及其任一种可能的实现方式中提供的模型保护方法。In a ninth aspect, the present application provides a computer device, the computer device includes: a processor and a memory, and a computer program is stored in the memory. When the processor executes the computer program, the computer device implements the model protection method provided in the eighth aspect and any possible implementation manner thereof.
第十方面,本申请提供了一种计算机可读存储介质,该计算机可读存储介质中存储有指令,当该指令被处理器执行时,实现第八方面以及其任一种可能的实现方式中提供的模型保护方法。In a tenth aspect, the present application provides a computer-readable storage medium, where instructions are stored in the computer-readable storage medium, and when the instructions are executed by a processor, the eighth aspect and any possible implementation manner thereof are implemented. Provided model protection method.
第十一方面,本申请提供了一种模型保护装置。该模型保护装置包括:访问权限控制模块和内存控制器;访问权限控制模块用于获取读指令,读指令用于请求从内存中读取人工智能AI模型;访问权限控制模块还用于对读指令执行鉴权操作,并基于鉴权结果生成控制信号,控制信号用于指示是否对从内存中读取的AI模型进行解密;访问权限控制模块还用于将读指令发送至内存控制器;内存控制器用于基于读指令从内存中读取AI模型。In an eleventh aspect, the present application provides a model protection device. The model protection device includes: an access authority control module and a memory controller; the access authority control module is used to obtain a read instruction, and the read instruction is used to request to read the artificial intelligence AI model from the memory; the access authority control module is also used to read the instruction. Execute the authentication operation, and generate a control signal based on the authentication result. The control signal is used to indicate whether to decrypt the AI model read from the memory; the access authority control module is also used to send the read command to the memory controller; memory control The processor is used to read AI models from memory based on read instructions.
可选地,访问权限控制模块具体用于:获取读指令中包含的用于读取AI模型的读地址,基于读地址对读指令执行鉴权操作。Optionally, the access authority control module is specifically configured to: obtain a read address for reading the AI model included in the read instruction, and perform an authentication operation on the read instruction based on the read address.
可选地,控制信号包括第一控制信号和第二控制信号,第一控制信号用于指示对AI模型进行解密,第二控制信号用于指示不对AI模型进行解密,访问权限控制模块具体用于:当读地址为合法地址时,生成第一控制信号;当读地址为非法地址时,生成第二控制信号。Optionally, the control signal includes a first control signal and a second control signal, the first control signal is used to instruct the AI model to be decrypted, the second control signal is used to instruct not to decrypt the AI model, and the access authority control module is specifically used for : When the read address is a legal address, the first control signal is generated; when the read address is an illegal address, the second control signal is generated.
可选地,控制信号包括第一控制信号和第二控制信号,第一控制信号用于指示对AI模型进行解密,第二控制信号用于指示不对AI模型进行解密,模型保护装置中存储有解密权限标识,解密权限标识用于指示当前计算任务使用的AI模型是否允许被解密,访问权限控制模块具体用于:当读地址为合法地址且满足指定条件时,生成第一控制信号;当读地址为非法地址,和/或,不满足指定条件时,生成第二控制信号。其中,指定条件包括以下至少一个:解密权限标识指示当前计算任务使用的AI模型允许被解密;或,AI模型为加密模型。Optionally, the control signal includes a first control signal and a second control signal, the first control signal is used to instruct the AI model to be decrypted, the second control signal is used to instruct not to decrypt the AI model, and the decryption device is stored in the model protection device. Authority identifier, the decryption authority identifier is used to indicate whether the AI model used by the current computing task is allowed to be decrypted, and the access authority control module is specifically used to: when the read address is a legal address and meet the specified conditions, generate the first control signal; when the read address is is an illegal address, and/or when the specified condition is not met, a second control signal is generated. The specified condition includes at least one of the following: the decryption permission identifier indicates that the AI model used by the current computing task is allowed to be decrypted; or, the AI model is an encryption model.
可选地,访问权限控制模块还用于:当读地址为非法地址时,控制解密权限标识指示当前计算任务使用的所有AI模型均不允许被解密。Optionally, the access authority control module is further configured to: when the read address is an illegal address, control the decryption authority identifier to indicate that all AI models used by the current computing task are not allowed to be decrypted.
可选地,访问权限控制模块还用于:在完成当前计算任务后,将解密权限标识重置为指示允许解密。Optionally, the access authority control module is further configured to reset the decryption authority identifier to indicate that decryption is permitted after completing the current computing task.
可选地,模型保护装置还包括:第一寄存器,第一寄存器用于存储AI模型在内存中的有效地址范围,访问权限控制模块具体用于:从第一寄存器中读取有效地址范围,基于有效地址范围和读地址对读指令执行鉴权操作。Optionally, the model protection device further includes: a first register, where the first register is used to store the effective address range of the AI model in the memory, and the access authority control module is specifically used for: reading the effective address range from the first register, based on The valid address range and read address perform the authentication operation on the read command.
可选地,模型保护装置还包括:解密模块和专用处理器,专用处理器用于生成读指令,并将读指令发送至访问权限控制模块;解密模块用于接收访问权限控制模块生成的控制信号,并在控制信号的指示下,对AI模型进行解密后传输给专用处理器,或者,在控制信号的指示下,向专用处理器透传AI模型;专用处理器还用于基于解密模块传输的AI模型,执行当前计算任务。Optionally, the model protection device further includes: a decryption module and a dedicated processor, where the dedicated processor is used to generate a read instruction and send the read instruction to the access authority control module; the decryption module is used to receive the control signal generated by the access authority control module, And under the instruction of the control signal, the AI model is decrypted and transmitted to the dedicated processor, or, under the instruction of the control signal, the AI model is transparently transmitted to the dedicated processor; the dedicated processor is also used for the AI transmitted based on the decryption module. model, which executes the current computing task.
可选地,模型保护装置还包括:密钥生成模块。密钥生成模块用于获取模型保护装置的根密钥、AI模型的版本标识和模型保护装置的装置标识,基于根密钥、版本标识和装置标识,生成用于对AI模型进行解密的解密密钥。Optionally, the model protection device further includes: a key generation module. The key generation module is used to obtain the root key of the model protection device, the version ID of the AI model and the device ID of the model protection device, and generate a decryption key for decrypting the AI model based on the root key, version ID and device ID. key.
可选地,模型保护装置还包括:第二寄存器,第二寄存器用于存储解密密钥,解密模块具体用于从第二寄存器中读取解密密钥,在控制信号的指示下,采用解密密钥对AI模型解密。Optionally, the model protection device further includes: a second register, the second register is used to store the decryption key, the decryption module is specifically configured to read the decryption key from the second register, and under the instruction of the control signal, the decryption key is used. key to decrypt the AI model.
第十二方面,本申请提供了一种模型保护装置。该模型保护装置包括:访问权限控制模块和内存控制器。访问权限控制模块用于获取读指令,对读指令执行鉴权操作,并基于鉴权结果控制内存控制器是否从内存中读出AI模型。In a twelfth aspect, the present application provides a model protection device. The model protection device includes: an access authority control module and a memory controller. The access authority control module is used to obtain the read command, perform an authentication operation on the read command, and control whether the memory controller reads the AI model from the memory based on the authentication result.
在一种可实现方式中,访问权限控制模块具体用于获取读指令,对读指令执行鉴权操作,基于鉴权结果生成读指示信号,并将该读指示信号和读指令发送至内存控制器。该读指示信号用于指示是否从内存中读取AI模型。内存控制器用于在读指示信号的指示下,基于读指令 从内存中读取AI模型,或者,在读指示信号的指示下,不执行基于读指令从内存中读取AI模型的操作。In an implementation manner, the access authority control module is specifically configured to acquire a read instruction, perform an authentication operation on the read instruction, generate a read indication signal based on the authentication result, and send the read indication signal and the read instruction to the memory controller . The read indication signal is used to indicate whether to read the AI model from memory. The memory controller is used to read the AI model from the memory based on the read instruction under the instruction of the read instruction signal, or, under the instruction of the read instruction signal, not to perform the operation of reading the AI model from the memory based on the read instruction.
其中,读指示信号包括第一读指示信号和第二读指示信号。第一读指示信号用于指示从内存中读出AI模型。第二读指示信号用于指示不从内存中读出AI模型。相应的,访问权限控制模块具体用于在对读指令的鉴权通过时,生成第一读指示信号,在对读指令的鉴权不通过时,生成第二读指示信号。The read indication signal includes a first read indication signal and a second read indication signal. The first read indication signal is used to instruct the AI model to be read from the memory. The second read indication signal is used to instruct not to read the AI model from the memory. Correspondingly, the access authority control module is specifically configured to generate a first read instruction signal when the authentication of the read instruction is passed, and generate a second read instruction signal when the authentication of the read instruction fails.
在另一种可实现方式中,访问权限控制模块具体用于获取读指令,对读指令执行鉴权操作,基于鉴权结果确定是否向内存控制器发送读指令。可选地,访问权限控制模块具体用于在对读指令的鉴权通过时,将读指令发送至内存控制器,以便于内存控制器基于该读指令从内存中读出AI模型;在对读指令的鉴权不通过时,对读指令进行拦截,使得内存控制器无法接收到该读指令,从而无法从内存中读取该读指令请求读取的AI模型。In another implementation manner, the access authority control module is specifically configured to acquire a read instruction, perform an authentication operation on the read instruction, and determine whether to send the read instruction to the memory controller based on the authentication result. Optionally, the access authority control module is specifically configured to send the read instruction to the memory controller when the authentication of the read instruction is passed, so that the memory controller can read the AI model from the memory based on the read instruction; When the authentication of the instruction fails, the read instruction is intercepted, so that the memory controller cannot receive the read instruction, so that the AI model requested by the read instruction cannot be read from the memory.
可选地,访问权限控制模块具体用于获取读指令中包含的用于读取AI模型的读地址,基于读地址对读指令执行鉴权操作。Optionally, the access authority control module is specifically configured to acquire a read address for reading the AI model included in the read instruction, and perform an authentication operation on the read instruction based on the read address.
在一种可实现方式中,访问权限控制模块具体用于当读地址为合法地址时,确定对读指令的鉴权通过,当读地址为非法地址时,确定对读指令的鉴权不通过。In an achievable manner, the access authority control module is specifically configured to determine that the authentication of the read instruction passes when the read address is a legal address, and determines that the authentication of the read instruction fails when the read address is an illegal address.
可选地,模型保护装置中存储有解密权限标识,解密权限标识用于指示当前计算任务使用的AI模型是否允许被解密,访问权限控制模块具体用于:当读地址为合法地址且满足指定条件时,确定对读指令的鉴权通过;当读地址为非法地址,和/或,不满足指定条件时,确定对读指令的鉴权不通过。其中,指定条件包括以下至少一个:解密权限标识指示当前计算任务使用的AI模型允许被解密,或,AI模型为加密模型。Optionally, a decryption authority identifier is stored in the model protection device, and the decryption authority identifier is used to indicate whether the AI model used by the current computing task is allowed to be decrypted, and the access authority control module is specifically used for: when the read address is a legal address and meets the specified conditions. When the read instruction is passed, it is determined that the authentication of the read instruction is passed; when the read address is an illegal address, and/or the specified condition is not met, it is determined that the authentication of the read instruction is unsuccessful. The specified condition includes at least one of the following: the decryption permission identifier indicates that the AI model used by the current computing task is allowed to be decrypted, or the AI model is an encryption model.
可选地,访问权限控制模块还用于:当读地址为非法地址时,控制解密权限标识指示当前计算任务使用的所有AI模型均不允许被解密。Optionally, the access authority control module is further configured to: when the read address is an illegal address, control the decryption authority identifier to indicate that all AI models used by the current computing task are not allowed to be decrypted.
可选地,访问权限控制模块还用于:在完成当前计算任务后,将解密权限标识重置为指示允许解密。Optionally, the access authority control module is further configured to reset the decryption authority identifier to indicate that decryption is permitted after completing the current computing task.
可选地,模型保护装置还包括:第一寄存器,第一寄存器用于存储AI模型在内存中的有效地址范围。相应的,访问权限控制模块具体用于:从第一寄存器中读取有效地址范围,基于有效地址范围和读地址对读指令执行鉴权操作。Optionally, the model protection device further includes: a first register, where the first register is used to store the effective address range of the AI model in the memory. Correspondingly, the access authority control module is specifically configured to: read the effective address range from the first register, and perform an authentication operation on the read instruction based on the effective address range and the read address.
可选地,模型保护装置还包括:解密模块和专用处理器。专用处理器用于生成读指令,并将读指令发送至访问权限控制模块。解密模块用于对AI模型进行解密,并将解密后地AI模型传输给专用处理器,或者,向专用处理器透传AI模型;专用处理器还用于基于解密模块传输的AI模型,执行当前计算任务。Optionally, the model protection device further includes: a decryption module and a dedicated processor. A dedicated processor is used to generate read instructions and send the read instructions to the access rights control module. The decryption module is used to decrypt the AI model, and transmit the decrypted AI model to the dedicated processor, or transparently transmit the AI model to the dedicated processor; the dedicated processor is also used to execute the current AI model based on the AI model transmitted by the decryption module. computing tasks.
可选地,模型保护装置还包括:密钥生成模块。密钥生成模块用于获取模型保护装置的根密钥、AI模型的版本标识和模型保护装置的装置标识,基于根密钥、版本标识和装置标识,生成用于对AI模型进行解密的解密密钥。Optionally, the model protection device further includes: a key generation module. The key generation module is used to obtain the root key of the model protection device, the version ID of the AI model and the device ID of the model protection device, and generate a decryption key for decrypting the AI model based on the root key, version ID and device ID. key.
可选地,模型保护装置还包括:第二寄存器,第二寄存器用于存储解密密钥。相应的,解密模块具体用于从第二寄存器中读取解密密钥,采用解密密钥对AI模型解密。Optionally, the model protection device further includes: a second register, where the second register is used to store the decryption key. Correspondingly, the decryption module is specifically configured to read the decryption key from the second register, and use the decryption key to decrypt the AI model.
第十三方面,本申请提供了一种模型保护方法,该模型保护方法包括:第一计算机设备获取人工智能模型的责任方标识和根密钥;第三计算机设备获取第二计算机设备提供的模型保护装置的装置标识,并向第一计算机设备发送模型保护装置的装置标识,第三计算机设备 中部署有模型保护装置,模型保护装置用于运行人工智能模型;第一计算机设备为人工智能模型分配版本标识,根据模型保护装置的装置标识、人工智能模型的版本标识和根密钥,生成人工智能模型的加密密钥;第一计算机设备使用加密密钥对人工智能模型加密,向第三计算机设备发送加密后的人工智能模型,第三计算机设备将加密后的人工智能模型烧写到第三计算机设备的非易失性存储介质中。In a thirteenth aspect, the present application provides a model protection method. The model protection method includes: a first computer device obtains a responsible party identifier and a root key of an artificial intelligence model; a third computer device obtains a model provided by a second computer device The device identification of the protection device, and the device identification of the model protection device is sent to the first computer equipment, the model protection device is deployed in the third computer equipment, and the model protection device is used to run the artificial intelligence model; the first computer equipment is allocated for the artificial intelligence model The version identification, according to the device identification of the model protection device, the version identification of the artificial intelligence model, and the root key, the encryption key of the artificial intelligence model is generated; the first computer equipment uses the encryption key to encrypt the artificial intelligence model, and sends it to the third computer equipment The encrypted artificial intelligence model is sent, and the third computer device burns the encrypted artificial intelligence model into the non-volatile storage medium of the third computer device.
由于加密秘钥根据装置标识、根密钥和版本标识得到,当装置标识、根密钥和版本标识中的任一个不同时,得到的加密秘钥不同。并且,由于不同模型保护装置的装置标识不同,使得根据不同模型保护装置的装置标识生成的加密密钥不同,因此能够使用不同的模型保护装置保护不同的AI模型。Since the encryption key is obtained according to the device ID, the root key and the version ID, when any one of the device ID, the root key and the version ID is different, the obtained encryption keys are different. In addition, since the device identifiers of different model protection devices are different, the encryption keys generated according to the device identifiers of different model protection devices are different, so different model protection devices can be used to protect different AI models.
可选地,第一计算机设备可以生成模型厂商标识,并根据该模型厂商标识生成根密钥,以得到模型厂商标识和根密钥。或者,第一计算机设备可以向第二计算机设备请求分配根密钥,第二计算机设备可以根据第一计算机设备的请求为模型厂商分配模型厂商标识,然后根据该模型厂商标识生成根密钥,并将根密钥和模型厂商标识发送至第一计算机设备。Optionally, the first computer device may generate a model manufacturer identification, and generate a root key according to the model manufacturer identification, so as to obtain the model manufacturer identification and the root key. Alternatively, the first computer device may request the second computer device to assign a root key, and the second computer device may assign a model manufacturer identifier to the model manufacturer according to the request of the first computer device, and then generate a root key according to the model manufacturer identifier, and The root key and model manufacturer identification are sent to the first computer device.
在一种可实现方式中,根密钥根据该模型厂商标识和芯片厂商提供的基础根密钥生成。In an implementation manner, the root key is generated according to the model manufacturer ID and the basic root key provided by the chip manufacturer.
进一步地,为了能够安全地存储根密钥,可以将该根密钥预置在模型保护装置的非易失性存储介质中。Further, in order to be able to store the root key securely, the root key may be preset in a non-volatile storage medium of the model protection device.
可选地,为了便于终端厂商的计算装置能够对该加密后的AI模型进行解密,第一计算机设备还需要向第三计算机设备发送责任方标识和版本标识。Optionally, in order for the computing device of the terminal manufacturer to be able to decrypt the encrypted AI model, the first computer device also needs to send the responsible party identifier and the version identifier to the third computer device.
附图说明Description of drawings
图1是本申请实施例提供的一种计算装置的结构示意图;FIG. 1 is a schematic structural diagram of a computing device provided by an embodiment of the present application;
图2是本申请实施例提供的另一种计算装置的结构示意图;FIG. 2 is a schematic structural diagram of another computing device provided by an embodiment of the present application;
图3是本申请实施例提供的一种模型保护装置的结构示意图;3 is a schematic structural diagram of a model protection device provided by an embodiment of the present application;
图4是本申请实施例提供的一种模型保护装置的结构示意图;4 is a schematic structural diagram of a model protection device provided by an embodiment of the present application;
图5是本申请实施例提供的又一种计算装置的结构示意图;FIG. 5 is a schematic structural diagram of another computing device provided by an embodiment of the present application;
图6是本申请实施例提供的一种读指令在专用处理器和内存控制器之间传输的示意图;6 is a schematic diagram of a read instruction being transmitted between a dedicated processor and a memory controller according to an embodiment of the present application;
图7是本申请实施例提供的一种访问权限控制器执行鉴权操作,并根据鉴权结果生成控制信号的方法流程图;7 is a flowchart of a method for an access authority controller to perform an authentication operation and to generate a control signal according to an authentication result according to an embodiment of the present application;
图8是本申请实施例提供的一种生成AI模型的加密密钥、AI模型的加密和解密过程的流程图;8 is a flowchart of an encryption key for generating an AI model, and an encryption and decryption process for the AI model provided by an embodiment of the present application;
图9是本申请实施例提供的一种图8中信息传递的过程示意图;FIG. 9 is a schematic diagram of a process of information transmission in FIG. 8 provided by an embodiment of the present application;
图10是本申请实施例提供的一种模型保护方法的流程图;10 is a flowchart of a model protection method provided by an embodiment of the present application;
图11是本申请实施例提供的一种计算机设备的结构示意图;11 is a schematic structural diagram of a computer device provided by an embodiment of the present application;
图12是本申请实施例提供的另一种模型保护方法的流程图;12 is a flowchart of another model protection method provided by an embodiment of the present application;
图13是本申请实施例提供的又一种模型保护方法的流程图。FIG. 13 is a flowchart of another model protection method provided by an embodiment of the present application.
具体实施方式Detailed ways
为使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请实施方式作进一步地详细描述。In order to make the objectives, technical solutions and advantages of the present application clearer, the embodiments of the present application will be further described in detail below with reference to the accompanying drawings.
随着人工智能技术的快速发展,越来越多的应用场景中使用AI模型解决问题。AI模型是非常宝贵且极具价值的知识产权,对其进行保护具有重要意义。通过对AI模型进行保护,能够减小AI模型被泄露和滥用的风险,从而保证投资创建AI模型的企业的权益。With the rapid development of artificial intelligence technology, more and more application scenarios use AI models to solve problems. AI models are very valuable and valuable intellectual property, and it is of great significance to protect them. By protecting the AI model, the risk of AI model being leaked and abused can be reduced, thereby guaranteeing the rights and interests of enterprises that invest in creating AI models.
AI模型的使用场景通常涉及AI模型、实现该AI模型所依赖的专用处理器和使用该AI模型执行计算任务的计算装置。其中,AI模型依赖专用处理器是指AI模型的功能的实现,需要占用专用处理器中的硬件资源。并且,为了计算装置能够使用AI模型,计算装置中需要部署有实现该AI模型所依赖的专用处理器。示例地,AI模型可以为用于实现人脸识别的计算机程序,专用处理器可以为神经网络处理单元(neural-network processing unit,NPU),通过使用该神经网络处理单元中的硬件能够实现该AI模型的人脸识别功能,计算装置中部署有该专用处理器的摄像头,该摄像头可以通过人脸识别功能实现门禁控制等功能。The usage scenarios of the AI model generally involve the AI model, the special-purpose processor on which the AI model is implemented, and the computing device that uses the AI model to perform computing tasks. Among them, the AI model relies on a dedicated processor means that the realization of the functions of the AI model needs to occupy the hardware resources in the dedicated processor. Furthermore, in order for a computing device to be able to use an AI model, a dedicated processor on which the AI model is implemented needs to be deployed in the computing device. For example, the AI model may be a computer program for implementing face recognition, and the special-purpose processor may be a neural-network processing unit (NPU), which can implement the AI by using hardware in the neural-network processing unit. The face recognition function of the model, the camera of the special processor is deployed in the computing device, and the camera can realize functions such as access control through the face recognition function.
其中,计算任务通常包括多个操作。例如,用于进行人脸识别的计算任务包括:人脸检测、人脸关键点定位、人脸矫正、人脸特征提取和特征比对等多个操作。Among them, computing tasks usually include multiple operations. For example, the computational tasks used for face recognition include: face detection, face key point location, face correction, face feature extraction, and feature comparison and other operations.
通常地,该AI模型、专用处理器和计算装置由至少两个厂商提供。在一种实现情况中,AI模型由模型厂商提供,专用处理器由芯片厂商提供,计算装置由终端厂商提供。其中,专用处理器能够提供接口,AI模型通过该接口能够与专用处理器中的硬件协同工作,从而实现该AI模型的功能。终端厂商能够对专用处理器和非易失性存储介质等其他装置进行组装,得到计算装置,并将AI模型烧写至该计算装置的非易失性存储介质中,使得该计算装置能够使用该AI模型和该专用处理器执行计算任务。在另一种实现情况中,AI模型和专用处理器由同一厂商提供,计算装置由终端厂商提供。此时,终端厂商对专用处理器和非易失性存储介质等其他装置进行组装,能够得到计算装置,并将AI模型烧写至该计算装置的非易失性存储介质中。Typically, the AI model, dedicated processor and computing device are provided by at least two vendors. In an implementation situation, the AI model is provided by the model manufacturer, the dedicated processor is provided by the chip manufacturer, and the computing device is provided by the terminal manufacturer. Among them, the dedicated processor can provide an interface, through which the AI model can cooperate with the hardware in the dedicated processor to realize the function of the AI model. Terminal manufacturers can assemble special processors and other devices such as non-volatile storage media to obtain a computing device, and program the AI model into the non-volatile storage medium of the computing device, so that the computing device can use the computing device. The AI model and this dedicated processor perform computational tasks. In another implementation, the AI model and the dedicated processor are provided by the same manufacturer, and the computing device is provided by the terminal manufacturer. At this time, the terminal manufacturer assembles other devices such as a dedicated processor and a non-volatile storage medium to obtain a computing device, and program the AI model into the non-volatile storage medium of the computing device.
下面以图1为例,对计算装置0使用AI模型的过程进行说明。图1为本申请实施例提供的一种计算装置0的结构示意图。如图1所示,该计算装置0包括:驱动模块10、内存20、内存控制器301和专用处理器303。The process of using the AI model by the computing device 0 will be described below by taking FIG. 1 as an example. FIG. 1 is a schematic structural diagram of a computing device 0 according to an embodiment of the present application. As shown in FIG. 1 , the computing device 0 includes: a driver module 10 , a memory 20 , a memory controller 301 and a dedicated processor 303 .
驱动模块10用于接收AI应用程序发送的任务请求,根据任务请求确定任务请求所需的AI模型,从计算装置0的非易失性存储介质(图1未示出)中获取该AI模型,然后,向内存控制器301申请内存20,并将AI模型和任务请求携带的待计算数据存储在内存控制器301分配的内存20中,再向专用处理器303发送任务执行指示,以指示专用处理器303执行任务请求所请求执行的计算任务。应当理解,驱动模块10通常是软件实现的,在一种可选的情况中,驱动模块也可以称为驱动程序。其中,任务执行指示用于通知专用处理器303待计算数据在内存20中的存储地址和AI模型在内存20中的存储地址等任务信息。其中,驱动模块10不需要对AI模型进行解密,可以直接将AI模型存储至内存20中。可选地,AI应用程序可以通过应用程序接口(application programming interface,API)向驱动模块10发送任务请求。在一种可实现方式中,驱动模块10可以通过软件实现。The driving module 10 is configured to receive the task request sent by the AI application, determine the AI model required by the task request according to the task request, and obtain the AI model from the non-volatile storage medium (not shown in FIG. 1 ) of the computing device 0, Then, apply for the memory 20 to the memory controller 301, store the data to be calculated carried by the AI model and the task request in the memory 20 allocated by the memory controller 301, and then send a task execution instruction to the dedicated processor 303 to instruct the dedicated processing The processor 303 executes the computing task requested by the task request. It should be understood that the driver module 10 is usually implemented in software, and in an optional case, the driver module may also be referred to as a driver. The task execution instruction is used to notify the dedicated processor 303 of task information such as the storage address of the data to be calculated in the memory 20 and the storage address of the AI model in the memory 20 . The driving module 10 does not need to decrypt the AI model, and can directly store the AI model in the memory 20 . Optionally, the AI application may send a task request to the driving module 10 through an application programming interface (application programming interface, API). In an implementation manner, the driving module 10 may be implemented by software.
专用处理器303用于根据该任务执行指示,获取内存20中存储的待计算数据和AI模型,并使用该AI模型对该待计算数据执行计算任务,并将结算结果存储至内存20中。其中,专用处理器303在需要获取内存20中存储的待计算数据和AI模型时,可以向内存控制器301发送用于请求读取AI模型的读指令和用于请求读取待计算数据的读命令,以便于内存控制器301从内存20中读取AI模型和待计算数据,并将该AI模型和待计算数据发送至该专用处理 器303。The dedicated processor 303 is configured to obtain the data to be calculated and the AI model stored in the memory 20 according to the task execution instruction, use the AI model to perform a calculation task on the data to be calculated, and store the settlement result in the memory 20 . Wherein, when the dedicated processor 303 needs to acquire the data to be calculated and the AI model stored in the memory 20, it can send a read instruction for requesting to read the AI model and a read instruction for requesting to read the data to be calculated to the memory controller 301 command, so that the memory controller 301 reads the AI model and the data to be calculated from the memory 20 , and sends the AI model and the data to be calculated to the dedicated processor 303 .
由上可知,在图1所示的计算装置0中,当AI模型和计算装置0由不同厂商提供时,若不对AI模型进行加密,计算装置0对AI模型的使用将不会受到有效限制。因此,为了保证提供AI模型的模型厂商的权益,亟需对模型厂商提供的AI模型进行保护。As can be seen from the above, in the computing device 0 shown in FIG. 1 , when the AI model and the computing device 0 are provided by different manufacturers, if the AI model is not encrypted, the use of the AI model by the computing device 0 will not be effectively restricted. Therefore, in order to ensure the rights and interests of model manufacturers that provide AI models, it is urgent to protect the AI models provided by model manufacturers.
为此,本申请实施例提供了一种模型保护装置30,该模型保护装置30能够对读取AI模型的操作进行鉴权,并根据鉴权结果确定是否对从内存20中读取的AI模型进行解密,以通过对AI模型进行解密的过程进行控制,防止AI的泄露和滥用,实现对AI模型的保护。To this end, the embodiment of the present application provides a model protection device 30, the model protection device 30 can authenticate the operation of reading an AI model, and determine whether to perform an operation on the AI model read from the memory 20 according to the authentication result. Decryption is performed to control the process of decrypting the AI model, prevent the leakage and abuse of AI, and realize the protection of the AI model.
该模型保护装置30可以部署在计算装置0中。本申请实施例提供了一种计算装置。该计算装置0可以为摄像头、台式电脑、移动电话、平板电脑、智能电视、智能可穿戴设备、车载通信设备和计算机等。图2为本申请实施例提供的另一种计算装置0的结构示意图。如图2所示,该计算装置0包括:驱动模块10、内存20和模型保护装置30,且该模型保护装置30包括内存控制器301、访问权限控制器(access permission controller,APC)302和专用处理器303。其中,该计算装置0中驱动模块10、内存20和专用处理器303的工作过程请相应参考图1中计算装置0中对应器件的工作过程,此处不再赘述。The model protector 30 may be deployed in the computing device 0 . Embodiments of the present application provide a computing device. The computing device 0 may be a camera, a desktop computer, a mobile phone, a tablet computer, a smart TV, a smart wearable device, an in-vehicle communication device, a computer, and the like. FIG. 2 is a schematic structural diagram of another computing device 0 according to an embodiment of the present application. As shown in FIG. 2, the computing device 0 includes: a driver module 10, a memory 20 and a model protection device 30, and the model protection device 30 includes a memory controller 301, an access permission controller (APC) 302, and a dedicated processor 303. The working process of the driving module 10 , the memory 20 and the dedicated processor 303 in the computing device 0 can be referred to the working process of the corresponding device in the computing device 0 in FIG. 1 , which will not be repeated here.
可选地,驱动模块10通过任务执行指示通知专用处理器303待计算数据在内存20中的存储地址和AI模型在内存20中的存储地址,可以通过链表节点实现。例如,任务执行指示中可以携带有链表节点在内存20中的地址,且该链表节点中存储有AI模型在内存20中的存储地址。此时,专用处理器303接收到任务执行指示时,会读取到链表节点在内存20中的地址,然后,专用处理器303根据链表节点在内存20中的地址在内存20中获取链表节点,并从该链表节点中获取AI模型在内存20中的存储地址,然后根据从链表节点中获取的地址从内存20中获取AI模型。其中,链表是一种数据结构,链表包括具有逻辑顺序的多个链表结点。每个链表结点包括两个部分:一个用于存储链表节点的数据域,另一个用于指示下一个链表结点地址的链接。在本申请实施例中,链表节点的数据域用于指示AI模型在内存20中的存储地址。Optionally, the driver module 10 notifies the dedicated processor 303 of the storage address of the data to be calculated in the memory 20 and the storage address of the AI model in the memory 20 through the task execution instruction, which can be implemented through a linked list node. For example, the task execution instruction may carry the address of the linked list node in the memory 20, and the linked list node stores the storage address of the AI model in the memory 20. At this time, when the dedicated processor 303 receives the task execution instruction, it will read the address of the linked list node in the memory 20, and then the dedicated processor 303 obtains the linked list node in the memory 20 according to the address of the linked list node in the memory 20, And obtain the storage address of the AI model in the memory 20 from the linked list node, and then obtain the AI model from the memory 20 according to the address obtained from the linked list node. Among them, the linked list is a data structure, and the linked list includes a plurality of linked list nodes with logical order. Each linked list node consists of two parts: one is used to store the data field of the linked list node, and the other is used to indicate the link of the address of the next linked list node. In this embodiment of the present application, the data field of the linked list node is used to indicate the storage address of the AI model in the memory 20 .
由于计算装置0通常需要处理大量的计算任务,为保证计算任务的有序执行,在本申请实施例提供的计算装置0中,驱动模块10向专用处理器303发送任务执行指示,到专用处理器303获取内存20中存储的待计算数据和AI模型的过程,可以通过硬件队列(hard ware queue)实现。其中,硬件队列中通常排队有多个计算任务,专用处理器303能够按照硬件队列中多个计算任务的顺序,串行地执行该多个计算任务。其中,图1和图2均未示出计算装置0还包括硬件队列。Since the computing device 0 usually needs to process a large number of computing tasks, in order to ensure the orderly execution of the computing tasks, in the computing device 0 provided in the embodiment of the present application, the driver module 10 sends a task execution instruction to the special-purpose processor 303, and the special-purpose processor 303 sends a task execution instruction to the special-purpose processor 303 The process of acquiring the data to be calculated and the AI model stored in the memory 20 can be implemented through a hardware queue. There are usually multiple computing tasks queued in the hardware queue, and the dedicated processor 303 can execute the multiple computing tasks serially according to the order of the multiple computing tasks in the hardware queue. 1 and 2 do not show that the computing device 0 further includes a hardware queue.
例如,驱动模块10可以将任务执行指示写入硬件队列中,写入硬件队列中的任务执行指示会在该硬件队列中按序排队,在到达该任务执行指示所指示的计算任务的执行时机时,该硬件队列向专用处理器303发送任务执行指示。专用处理器303接收到任务执行指示后,向硬件队列发送请求从内存20中读取AI模型的读指令。硬件队列根据该读指令,向内存控制器301发送请求从内存20中读取AI模型的读指令。并且,硬件队列从内存20中读取AI模型后,会将AI模型发送至专用处理器303,使得该专用处理器303使用该AI模型对待计算数据执行计算任务。For example, the driver module 10 can write the task execution instruction into the hardware queue, and the task execution instruction written in the hardware queue will be queued in the hardware queue in order, when the execution timing of the computing task indicated by the task execution instruction arrives , the hardware queue sends a task execution instruction to the dedicated processor 303 . After receiving the task execution instruction, the dedicated processor 303 sends a read instruction requesting to read the AI model from the memory 20 to the hardware queue. According to the read command, the hardware queue sends a read command requesting to read the AI model from the memory 20 to the memory controller 301 . In addition, after the hardware queue reads the AI model from the memory 20, the AI model is sent to the special-purpose processor 303, so that the special-purpose processor 303 uses the AI model to perform computing tasks on the data to be computed.
并且,专用处理器303开始执行任务执行指示所指示的计算任务的操作可以通过寄存器 触发。当通过硬件队列和链表节点实现计算任务时,该寄存器用于触发硬件队列从内存20中获取链表节点,并从该链表节点中获取AI模型在内存20中的存储地址,并向专用处理器303发送获取的地址,以便于专用处理器303根据对应的地址发送读指令。Also, the operation of the special purpose processor 303 to start executing the computing task indicated by the task execution instruction may be triggered by a register. When the computing task is implemented through the hardware queue and the linked list node, this register is used to trigger the hardware queue to obtain the linked list node from the memory 20, and obtain the storage address of the AI model in the memory 20 from the linked list node, and send it to the dedicated processor 303 The acquired address is sent, so that the special-purpose processor 303 sends a read command according to the corresponding address.
另外,计算装置0还可以包括内存管理器(memory management unit,MMU)(图2中未示出),该内存管理器用于在访问内存的请求携带的地址与数据存储在内存中物理地址之间进行地址映射。这样一来,内存控制器301可以通过内存管理器与内存20间接连接,且该内存控制器301与内存20之间的交互可以通过该内存管理器实现。In addition, the computing device 0 may further include a memory management unit (MMU) (not shown in FIG. 2 ), the memory manager is used for between the address carried by the request for accessing the memory and the physical address where the data is stored in the memory Perform address mapping. In this way, the memory controller 301 can be indirectly connected to the memory 20 through the memory manager, and the interaction between the memory controller 301 and the memory 20 can be realized through the memory manager.
需要说明的是,由于专用处理器303向硬件队列发送读指令后,硬件队列会根据向内存控制器301转发该读指令,且硬件队列从内存20中读取AI模型后,会将AI模型发送至专用处理器303,因此,该过程可以看成是专用处理器303通过发送读命令实现从内存20中读取AI模型的过程。并且,当驱动模块10向专用处理器303发送任务执行指示,到专用处理器303从内存20中读取待计算数据和AI模型的过程,不通过硬件队列实现时,专用处理器303也需要向内存控制器301发送读指令,以从内存20中读取AI模型。因此,在本申请实施例中,为描述的简便,无论驱动模块10向专用处理器303发送任务执行指示,到专用处理器303从内存20中读取待计算数据和AI模型的过程,是否通过硬件队列实现,专用处理器303发送读指令均可看成是向内存控制器301发送读指令,从专用处理器303发送读指令到专用处理器303从内存20中读出的AI模型的过程,都简称为专用处理器303向内存控制器301发送读指令,实现从内存20中读取AI模型的过程,并不对是否存在硬件队列的实现方式进行区分,也不对专用处理器303发送读指令的对象进行区分。It should be noted that, after the dedicated processor 303 sends the read command to the hardware queue, the hardware queue will forward the read command to the memory controller 301 according to the read command, and after the hardware queue reads the AI model from the memory 20, it will send the AI model. to the special-purpose processor 303, therefore, this process can be regarded as a process in which the special-purpose processor 303 realizes reading the AI model from the memory 20 by sending a read command. In addition, when the driver module 10 sends a task execution instruction to the special-purpose processor 303, and the special-purpose processor 303 reads the data to be calculated and the AI model from the memory 20, when the process of reading the data to be calculated and the AI model from the memory 20 is not implemented through a hardware queue, the special-purpose processor 303 also needs to The memory controller 301 sends a read command to read the AI model from the memory 20 . Therefore, in the embodiments of the present application, for the convenience of description, no matter whether the drive module 10 sends a task execution instruction to the special-purpose processor 303, and the special-purpose processor 303 reads the data to be calculated and the AI model from the memory 20, whether the process passes The hardware queue implementation, the special processor 303 sending the read command can be regarded as the process of sending the read command to the memory controller 301, and sending the read command from the special processor 303 to the AI model read from the memory 20 by the special processor 303, It is abbreviated as the special-purpose processor 303 sends a read command to the memory controller 301 to realize the process of reading the AI model from the memory 20, and does not distinguish whether there is a hardware queue or not, nor does it send a read command to the special-purpose processor 303. objects are distinguished.
下面对本申请实施例提供的模型保护装置30的实现方式进行说明。如图3所示,该模型保护装置30包括:访问权限控制器302和内存控制器301。The implementation manner of the model protection device 30 provided by the embodiments of the present application will be described below. As shown in FIG. 3 , the model protection device 30 includes: an access authority controller 302 and a memory controller 301 .
访问权限控制器302用于获取读指令,对读指令执行鉴权操作,基于鉴权结果生成控制信号,并将读指令发送至内存控制器301。其中,读指令用于请求从内存20中读取AI模型。控制信号用于指示是否对从内存20中读取的AI模型进行解密。该控制信号可以包括第一控制信号和第二控制信号。第一控制信号用于指示对AI模型进行解密。第二控制信号用于指示不对AI模型进行解密。The access authority controller 302 is configured to acquire a read instruction, perform an authentication operation on the read instruction, generate a control signal based on the authentication result, and send the read instruction to the memory controller 301 . Among them, the read instruction is used to request to read the AI model from the memory 20 . The control signal is used to indicate whether to decrypt the AI model read from the memory 20 . The control signal may include a first control signal and a second control signal. The first control signal is used to instruct to decrypt the AI model. The second control signal is used to indicate that the AI model is not decrypted.
内存控制器301用于基于读指令从内存20中读取AI模型。The memory controller 301 is used to read the AI model from the memory 20 based on the read instruction.
其中,AI模型多种多样,不同的应用场景可以使用不同的AI模型。在一种可实现方式中,本申请实施例中的AI模型可以是神经网络模型。Among them, there are various AI models, and different AI models can be used in different application scenarios. In an implementation manner, the AI model in this embodiment of the present application may be a neural network model.
由上可知,通过访问权限控制器302对读指令进行鉴权,能够生成指示是否对从内存20中读取的AI模型进行解密,当该AI模型以加密模型的形式存储在内存20中时,若控制信号指示对该AI模型进行解密,才有可能成功使用该AI模型,若控制信号指示不对该AI模型进行解密,则无法使用该AI模型。因此,在本申请实施例提供的访问权限控制器302中,通过对AI模型进行解密的过程进行控制,能够防止AI的泄露和滥用,实现对该AI模型的保护。As can be seen from the above, the access authority controller 302 authenticates the read instruction, and can generate an instruction whether to decrypt the AI model read from the memory 20. When the AI model is stored in the memory 20 in the form of an encrypted model, If the control signal indicates that the AI model is decrypted, it is possible to use the AI model successfully. If the control signal indicates that the AI model is not decrypted, the AI model cannot be used. Therefore, in the access authority controller 302 provided in the embodiment of the present application, by controlling the process of decrypting the AI model, the leakage and abuse of the AI can be prevented, and the protection of the AI model can be achieved.
进一步地,如图4所示,模型保护装置30还可以包括:解密电路304和专用处理器303。Further, as shown in FIG. 4 , the model protection device 30 may further include: a decryption circuit 304 and a dedicated processor 303 .
该专用处理器303用于生成读指令,并将读指令发送至访问权限控制器302,以便于访问权限控制器302对该读指令执行鉴权操作。其中,驱动模块10将AI模型和待计算数据存 储在内存20中之后,该驱动模块10可以向专用处理器303发送任务执行指示,以指示专用处理器303执行任务请求所请求的计算任务。相应的,该专用处理器303可以根据该任务执行指示生成读指令,并将该读指令发送至访问权限控制器302。并且,该任务执行指示中可以携带有AI模型在内存20中的内存20地址,相应的,该专用处理器303发送的读指令中可以携带有该内存20地址。The dedicated processor 303 is configured to generate a read instruction, and send the read instruction to the access authority controller 302, so that the access authority controller 302 can perform an authentication operation on the read instruction. Wherein, after the driving module 10 stores the AI model and the data to be calculated in the memory 20, the driving module 10 can send a task execution instruction to the special-purpose processor 303 to instruct the special-purpose processor 303 to execute the computing task requested by the task request. Correspondingly, the dedicated processor 303 may generate a read instruction according to the task execution instruction, and send the read instruction to the access authority controller 302 . Moreover, the task execution instruction may carry the memory 20 address of the AI model in the memory 20, and correspondingly, the read instruction sent by the dedicated processor 303 may carry the memory 20 address.
解密电路304用于接收访问权限控制器302生成的控制信号,并在控制信号的指示下,对AI模型进行解密后传输给专用处理器303,或者,在控制信号的指示下,向专用处理器303透传AI模型。可选地,解密电路304可以采用解密算法对AI模型进行解密。该解密电路304使用的解密算法可以为符合国际标准化组织(international organization for standardization,ISO)/国际电工委员会(international electrotechnical commission,IEC)国际标准的块密码算法。例如,该解密电路304使用的解密算法可以为高级加密标准(advanced encryption standard,AES)算法。The decryption circuit 304 is used to receive the control signal generated by the access authority controller 302, and under the instruction of the control signal, decrypt the AI model and transmit it to the dedicated processor 303, or, under the instruction of the control signal, to the dedicated processor. 303 Transparent AI model. Optionally, the decryption circuit 304 can use a decryption algorithm to decrypt the AI model. The decryption algorithm used by the decryption circuit 304 may be a block cipher algorithm conforming to the International Organization for Standardization (ISO)/International Electrotechnical Commission (IEC) international standard. For example, the decryption algorithm used by the decryption circuit 304 may be an advanced encryption standard (AES) algorithm.
专用处理器303还用于基于解密电路304传输的AI模型,执行当前计算任务。该专用处理器303具体用于运行该专用处理器303中的电路等硬件实现对AI模型的硬件加速,从而实现基于AI模型执行计算任务的目的。专用处理器303可以为专用于进行AI计算的处理器,例如,该专用处理器303可以为NPU。The dedicated processor 303 is also used for executing the current computing task based on the AI model transmitted by the decryption circuit 304 . The dedicated processor 303 is specifically configured to run hardware such as circuits in the dedicated processor 303 to implement hardware acceleration of the AI model, so as to achieve the purpose of performing computing tasks based on the AI model. The dedicated processor 303 may be a processor dedicated to performing AI calculations, for example, the dedicated processor 303 may be an NPU.
在一种可实现方式中,如图5和图6所示,访问权限控制器302可以挂载在专用处理器303向内存控制器301发送读命令的读通道上,解密电路304可以挂载在内存控制器301根据读命令向专用处理器303发送读响应的响应通道上。其中,读命令用于请求读取数据和计算机程序等内容,读指令为读命令中的一种,读指令用于请求读取计算机程序。此时,专用处理器303发送的读指令在专用处理器303与内存控制器301之间的传输路径为:先由专用处理器303发送至访问权限控制器302,再由访问权限控制器302发送至内存控制器301。因此,访问权限控制器302能够获取向内存控制器301发送的读指令,并对该读指令执行鉴权操作。并且,访问权限控制器302根据对读指令的鉴权结果生成控制信号,可以随读指令发送至内存控制器301。内存控制器301可以将根据读指令读取的AI模型携带在读响应中,并将控制信号随读响应发送至解密电路304,使得解密电路304根据该控制信号对AI进行解密,并向专用处理器303发送解密后的AI模型,或者解密电路304根据该控制信号向专用处理器303透传AI模型。In an implementation manner, as shown in FIG. 5 and FIG. 6 , the access authority controller 302 can be mounted on the read channel where the dedicated processor 303 sends the read command to the memory controller 301 , and the decryption circuit 304 can be mounted on the read channel. The memory controller 301 sends the read response to the special-purpose processor 303 on the response channel according to the read command. The read command is used for requesting to read content such as data and computer programs, the read command is one of the read commands, and the read command is used to request to read the computer program. At this time, the transmission path between the dedicated processor 303 and the memory controller 301 of the read instruction sent by the dedicated processor 303 is: firstly sent by the dedicated processor 303 to the access authority controller 302, and then sent by the access authority controller 302 to the memory controller 301 . Therefore, the access authority controller 302 can acquire the read command sent to the memory controller 301 and perform an authentication operation on the read command. In addition, the access authority controller 302 generates a control signal according to the authentication result of the read command, which can be sent to the memory controller 301 along with the read command. The memory controller 301 can carry the AI model read according to the read instruction in the read response, and send the control signal to the decryption circuit 304 along with the read response, so that the decryption circuit 304 decrypts the AI according to the control signal, and sends it to the dedicated processor. 303 sends the decrypted AI model, or the decryption circuit 304 transparently transmits the AI model to the dedicated processor 303 according to the control signal.
或者,访问权限控制器302可以挂载在专用处理器303向其他所有器件发送命令或数据的读通道上,使得访问权限控制器302可以获取专用处理器303发送的所有命令和数据。此时,访问权限控制器302还可以对获取的命令和数据进行分类,并对分类结果为向内存控制器301发送的读命令执行鉴权操作。Alternatively, the access authority controller 302 can be mounted on the read channel through which the special purpose processor 303 sends commands or data to all other devices, so that the access authority controller 302 can obtain all commands and data sent by the special purpose processor 303 . At this time, the access authority controller 302 may also classify the acquired commands and data, and perform an authentication operation on the read command sent to the memory controller 301 as a result of the classification.
又或者,访问权限控制器302可以通过其他方式实现,只要该访问权限控制器302能够获取专用处理器303发送的读指令,根据对读指令的鉴权结果生成控制信号,并将该控制信号发送至用于对AI模型解密的解密电路304,且发送至解密电路304的AI模型和用于指示是否对该AI模型进行解密的控制信号具有对应关系即可。例如,访问权限控制器302可以不挂载在专用处理器303向内存控制器301发送读命令的读通道上,专用处理器303在向内存控制器301发送读指令时,可以同步向访问权限控制器302发送该读指令,并指示根据该读指令读取的AI模型携带有该读指令的标识,且根据该读指令生成的控制信号携带有该读指令 的标识,以通过该读指令的标识建立AI模型和用于指示是否对该AI模型进行解密的控制信号具有对应关系,本申请实施例对其不做具体限定。其中,发送至解密电路304的AI模型和用于指示是否对该AI模型进行解密的控制信号具有对应关系,是为了解密电路304能够根据控制信号,确定是否对与该控制信号具有对应关系的AI模型进行解密。Alternatively, the access authority controller 302 can be implemented in other ways, as long as the access authority controller 302 can obtain the read command sent by the dedicated processor 303, generate a control signal according to the authentication result of the read command, and send the control signal To the decryption circuit 304 for decrypting the AI model, and the AI model sent to the decryption circuit 304 and the control signal for indicating whether to decrypt the AI model may have a corresponding relationship. For example, the access authority controller 302 may not be mounted on the read channel through which the special-purpose processor 303 sends the read command to the memory controller 301. When the special-purpose processor 303 sends the read command to the memory controller 301, the access authority control The device 302 sends the read instruction, and indicates that the AI model read according to the read instruction carries the identifier of the read instruction, and the control signal generated according to the read instruction carries the identifier of the read instruction, so as to pass the identifier of the read instruction. There is a corresponding relationship between the establishment of the AI model and the control signal used to indicate whether to decrypt the AI model, which is not specifically limited in this embodiment of the present application. Wherein, the AI model sent to the decryption circuit 304 has a corresponding relationship with the control signal used to indicate whether to decrypt the AI model, so that the decryption circuit 304 can determine whether the AI has a corresponding relationship with the control signal according to the control signal. The model is decrypted.
在一种可实现方式中,控制信号对解密过程的指示作用可以通过控制信号中携带的变量的取值实现。例如,当该变量的取值为1时,该控制信号用于指示对从内存20中读取的AI模型进行解密,此时,该控制信号可称为第一控制信号。当该变量的取值为0时,该控制信号用于指示不对从内存20中读取的AI模型进行解密,此时,该控制信号可称为第二控制信号。In an implementation manner, the indication function of the control signal on the decryption process can be realized by the value of the variable carried in the control signal. For example, when the value of the variable is 1, the control signal is used to instruct to decrypt the AI model read from the memory 20, and at this time, the control signal may be referred to as the first control signal. When the value of the variable is 0, the control signal is used to indicate that the AI model read from the memory 20 is not to be decrypted. At this time, the control signal may be referred to as a second control signal.
并且,控制信号可以采用随路信号的方式实现。例如,图5中虚线箭头表示控制信号的传输路径,如图5所示,访问权限控制器302向内存控制器301发送控制信号后,内存控制器301可以将该控制信号随AI模型发送至解密电路304。在一种可实现方式中,控制信号指示的内容可以通过变量的取值表示,相应的,内存控制器301可以将控制信号中变量的取值携带在向解密电路304发送的数据中的扩展字段中,以通过该扩展字段中的数值表示控制信号的指示作用。Moreover, the control signal can be implemented in the form of an associated signal. For example, the dashed arrow in FIG. 5 represents the transmission path of the control signal. As shown in FIG. 5 , after the access authority controller 302 sends the control signal to the memory controller 301, the memory controller 301 can send the control signal to the decryption device along with the AI model. circuit 304 . In an implementation manner, the content indicated by the control signal can be represented by the value of the variable. Correspondingly, the memory controller 301 can carry the value of the variable in the control signal in the extension field in the data sent to the decryption circuit 304 , the indication function of the control signal is expressed by the value in the extension field.
在访问权限控制器302执行鉴权操作的一种可实现方式中,访问权限控制器302可以获取读指令中包含的用于读取AI模型的读地址,并基于读地址对读指令执行鉴权操作。例如,除了获取读指令中包含的用于读取AI模型的读地址,访问权限控制器302还可以获取读指令请求读取的AI模型在内存20中的有效地址范围,并根据该读地址和该有效地址范围,执行对读指令的鉴权操作。其中,AI模型在内存20中的有效地址范围至少覆盖AI模型在内存20中的真实存储地址。AI模型在内存20中的有效地址范围可以是驱动模块10将AI模型存储在内存20中之后,根据AI模型在内存20中的存储地址设置的。In an implementation manner in which the access authority controller 302 performs the authentication operation, the access authority controller 302 may obtain the read address for reading the AI model contained in the read instruction, and perform authentication on the read instruction based on the read address operate. For example, in addition to acquiring the read address for reading the AI model contained in the read instruction, the access authority controller 302 can also acquire the effective address range in the memory 20 of the AI model requested to be read by the read instruction, and according to the read address and The valid address range is used to authenticate the read command. The effective address range of the AI model in the memory 20 at least covers the real storage address of the AI model in the memory 20 . The effective address range of the AI model in the memory 20 may be set according to the storage address of the AI model in the memory 20 after the driver module 10 stores the AI model in the memory 20 .
可选地,该有效地址范围可以采用寄存器存储。相应的,如图4所示,模型保护装置30还可以包括:第一寄存器305,该第一寄存器305用于存储AI模型在内存20中的有效地址范围。在一种可实现方式中,该第一寄存器305可以为用于实现存储有效地址范围的一个或多个寄存器的统称。例如,该有效地址范围可以通过两个寄存器中存储的变量表示,其中一个寄存器用于存储该有效地址范围的起始地址,另一个寄存器用于存储该有效地址范围的长度,或者,另一个寄存器用于存储该有效地址范围的终止地址。Alternatively, the effective address range may be stored in registers. Correspondingly, as shown in FIG. 4 , the model protection device 30 may further include: a first register 305 , where the first register 305 is used to store the effective address range of the AI model in the memory 20 . In an implementation manner, the first register 305 may be a general term for one or more registers used to store the effective address range. For example, the effective address range can be represented by variables stored in two registers, one of which is used to store the starting address of the effective address range, the other register is used to store the length of the effective address range, or another register is used to store the length of the effective address range. The ending address for storing this valid address range.
在一种可实现方式中,访问权限控制器302根据鉴权结果生成控制信号的实现过程可以包括:当读地址为合法地址时,访问权限控制器302生成第一控制信号;当读地址为非法地址时,访问权限控制器302生成第二控制信号。其中,当读地址位于AI模型的有效地址范围内时,该读地址称为合法地址,当读地址位于AI模型的有效地址范围外时,该读地址称为非法地址。In an implementation manner, the implementation process of the access authority controller 302 generating the control signal according to the authentication result may include: when the read address is a legal address, the access authority controller 302 generates the first control signal; when the read address is illegal address, the access authority controller 302 generates a second control signal. Among them, when the read address is within the valid address range of the AI model, the read address is called a legal address, and when the read address is outside the valid address range of the AI model, the read address is called an illegal address.
在另一种可实现方式中,访问权限控制器302还可以根据除读地址外的其他条件执行鉴权操作。例如,当读地址为合法地址且满足指定条件时,访问权限控制器302生成第一控制信号;当读地址为非法地址,和/或,不满足指定条件时,访问权限控制器302生成第二控制信号。其中,指定条件包括以下至少一个:解密权限标识指示当前计算任务使用的AI模型允许被解密,或,AI模型为加密模型。In another implementation manner, the access authority controller 302 may also perform the authentication operation according to other conditions than the read address. For example, when the read address is a legal address and the specified condition is met, the access authority controller 302 generates a first control signal; when the read address is an illegal address, and/or when the specified condition is not met, the access authority controller 302 generates a second control signal control signal. The specified condition includes at least one of the following: the decryption permission identifier indicates that the AI model used by the current computing task is allowed to be decrypted, or the AI model is an encryption model.
解密权限标识存储在模型保护装置30中。例如,解密权限标识可以存储在寄存器中。该 解密权限标识用于指示当前计算任务使用的AI模型是否允许被解密。并且,该解密权限标识的指示作用可以通过该解密权限标识的取值确定。在一种可实现方式中,当该解密权限标识的取值为0时,该解密权限标识用于指示当前计算任务使用的AI模型允许被解密,当该解密权限标识的取值为1时,该解密权限标识用于指示当前计算任务使用的AI模型不允许被解密,且该解密权限标识的默认值是0。The decryption authority identifier is stored in the model protector 30 . For example, the decryption rights identification can be stored in a register. The decryption permission identifier is used to indicate whether the AI model used by the current computing task is allowed to be decrypted. Moreover, the indication function of the decryption authority identifier can be determined by the value of the decryption authority identifier. In an implementation manner, when the value of the decryption authority identifier is 0, the decryption authority identifier is used to indicate that the AI model used by the current computing task is allowed to be decrypted, and when the value of the decryption authority identifier is 1, The decryption permission identifier is used to indicate that the AI model used by the current computing task is not allowed to be decrypted, and the default value of the decryption permission identifier is 0.
可选地,访问权限控制器302还可以根据读地址是否为合法地址,对解密权限标识进行设置。在一种可实现方式中,访问权限控制器302确定读地址为非法地址时,可以控制解密权限标识指示当前计算任务使用的所有AI模型均不允许被解密。这样一来,能够通过对读地址的判断,实现对AI模型进行解密的惩罚机制,即一旦确定读地址为非法地址,则对解密权限标识进行设置,以指示当前计算任务使用的所有AI模型都不允许被解密。当通过恶意模型对需要保护的AI模型进行攻击时,通常需要先从内存20中读出该恶意模型,而请求读取该恶意模型的读指令携带的读地址不是合法地址,此时,通过该惩罚机制能够对解密权限标识进行设置,使得解密权限标识指示当前计算任务使用的所有AI模型均不允许被解密,能够防止通过该恶意模型对AI模型进行攻击。Optionally, the access authority controller 302 may also set the decryption authority identifier according to whether the read address is a legal address. In an implementation manner, when the access authority controller 302 determines that the read address is an illegal address, it can control the decryption authority identifier to indicate that all AI models used by the current computing task are not allowed to be decrypted. In this way, the penalty mechanism for decrypting the AI model can be realized by judging the read address, that is, once the read address is determined to be an illegal address, the decryption permission flag is set to indicate that all AI models used in the current computing task are Decryption is not allowed. When attacking an AI model that needs to be protected through a malicious model, it is usually necessary to read the malicious model from the memory 20 first, and the read address carried by the read instruction requesting to read the malicious model is not a legal address. The penalty mechanism can set the decryption permission flag, so that the decryption permission flag indicates that all AI models used by the current computing task are not allowed to be decrypted, which can prevent the AI model from being attacked by this malicious model.
并且,由于该解密权限标识用于指示当前计算任务使用的AI模型是否允许被解密,因此,可以为计算装置0串行执行的多个计算任务设置一个解密权限标识,并通过该解密权限标识在不同计算任务的执行过程中的取值指示对应计算任务过程中使用的AI模型是否允许被解密。或者,也可以为不同计算任务分别设置解密权限标识,为每个计算任务设置的解密权限标识用于指示对应的计算任务使用的AI模型是否允许被解密。Moreover, since the decryption authority mark is used to indicate whether the AI model used by the current computing task is allowed to be decrypted, a decryption authority mark can be set for a plurality of computing tasks serially executed by the computing device 0, and the decryption authority mark is used in the The values during the execution of different computing tasks indicate whether the AI models used during the corresponding computing tasks are allowed to be decrypted. Alternatively, decryption permission identifiers may be set for different computing tasks respectively, and the decryption permission identifier set for each computing task is used to indicate whether the AI model used by the corresponding computing task is allowed to be decrypted.
相应的,当为计算装置0串行执行的多个计算任务设置一个解密权限标识时,在完成当前计算任务后,访问权限控制器302还可以将解密权限标识重置为指示允许解密,以保证在当前计算任务后面执行的计算任务能够正常获取AI模型。可选地,还可以通过其他方式对解密权限标识进行重置,例如,可以通过对计算装置0进行重新上电,实现对解密权限标识的重置,本申请实施例对其不做具体限定。Correspondingly, when a decryption authority identifier is set for a plurality of computing tasks performed serially by the computing device 0, after completing the current computing task, the access authority controller 302 can also reset the decryption authority identifier to indicate that decryption is permitted, so as to ensure that decryption is permitted. The computing task executed after the current computing task can obtain the AI model normally. Optionally, the decryption authority identifier may also be reset in other ways. For example, the decryption authority identifier may be reset by re-powering on the computing device 0, which is not specifically limited in this embodiment of the present application.
AI模型是否为加密模型可以通过AI模型的加密标识的取值确定。在一种可实现方式中,当加密标识的取值为0时,该加密标识用于指示AI模型为加密模型,当加密标识的取值为1时,该加密标识用于指示AI模型为非加密模型。AI模型是否为加密模型,可以根据模型厂商对模型的保护需求确定。当模型厂商需要对AI模型进行保护时,可以对AI模型加密,并设置加密标识指示AI模型为加密模型。当模型厂商不需要对AI模型进行保护时,则无需对AI模型加密,并设置加密标识指示AI模型为非加密模型。并且,加密标识可以存储在寄存器中,且寄存器中存储的加密标识的取值可以由驱动模块10设置。驱动模块10将模型烧写至计算装置0的非易失性存储介质中之后,该驱动模块10可以读取AI模型的文件头,该文件头携带有覆盖AI模型的模型信息,该模型信息包括指示该模型是否为加密模型和该模型的大小等信息,驱动模块10可以根据该模型信息对寄存器中加密标识的取值进行设置。Whether the AI model is an encrypted model can be determined by the value of the encrypted identifier of the AI model. In an implementation manner, when the value of the encryption identifier is 0, the encryption identifier is used to indicate that the AI model is an encrypted model, and when the value of the encryption identifier is 1, the encryption identifier is used to indicate that the AI model is a non-encrypted model. encryption model. Whether the AI model is an encrypted model can be determined according to the model manufacturer's protection requirements for the model. When the model manufacturer needs to protect the AI model, it can encrypt the AI model and set the encryption flag to indicate that the AI model is an encrypted model. When the model manufacturer does not need to protect the AI model, it does not need to encrypt the AI model, and set the encryption flag to indicate that the AI model is a non-encrypted model. Moreover, the encrypted identifier can be stored in a register, and the value of the encrypted identifier stored in the register can be set by the driving module 10 . After the drive module 10 writes the model into the non-volatile storage medium of the computing device 0, the drive module 10 can read the file header of the AI model, and the file header carries the model information covering the AI model, and the model information includes Indicates whether the model is an encrypted model and information such as the size of the model, and the driving module 10 can set the value of the encrypted identifier in the register according to the model information.
另外,由于专用处理器303在执行计算任务时,除了需要使用AI模型,还需要获取待计算数据等内容,因此,该专用处理器303还会向内存控制器301发送用于请求从内存20中读取数据等内容的读命令。并且,读命令需要经由专用处理器303向内存控制器301发送读命令的读通道传输至内存控制器301,因此访问权限控制器302除了会接收到用于请求读取AI模型的读指令,还会接收到用于请求从内存20中读取数据等内容的读命令。由于AI模型是 需要通过控制信号保护的对象,因此,访问权限控制器302执行鉴权操作的过程还包括:该访问权限控制器302判断接收的读命令是否为读指令,若访问权限控制器302接收的读命令不是读指令,表示该读命令不用于请求从内存20中读取AI模型,根据该读命令读取的数据无需解密,则访问权限控制器302可以生成用于指示不对根据该读命令读取的内容进行解密的控制信号。其中,读命令携带有命令标识,该命令标识用于指示读命令请求读取的内容,则可以根据读命令携带的命令标识,确定读命令是否为用于请求读取AI模型的读指令。In addition, since the dedicated processor 303 needs to obtain the data to be calculated in addition to using the AI model when performing the calculation task, the dedicated processor 303 also sends a request to the memory controller 301 to request data from the memory 20 A read command to read data, etc. In addition, the read command needs to be transmitted to the memory controller 301 via the read channel through which the dedicated processor 303 sends the read command to the memory controller 301. Therefore, the access authority controller 302 will not only receive the read command for requesting to read the AI model, but also A read command for requesting to read data, etc. from the memory 20 is received. Since the AI model is an object that needs to be protected by a control signal, the process of performing the authentication operation by the access authority controller 302 further includes: the access authority controller 302 determines whether the received read command is a read command, if the access authority controller 302 The received read command is not a read command, which means that the read command is not used to request to read the AI model from the memory 20, and the data read according to the read command does not need to be decrypted, then the access authority controller 302 can generate an instruction to indicate that the read command is not correct according to the read command. A control signal that commands the decryption of the read content. Wherein, the read command carries a command identifier, and the command identifier is used to indicate the content requested by the read command. Then, according to the command identifier carried by the read command, it can be determined whether the read command is a read command for requesting to read the AI model.
由于专用处理器303发送的读命令中的读地址根据该任务执行指示中可以携带的AI模型在内存20中的内存20地址确定,且当恶意程序对AI模型进行攻击时,该恶意程序会修改专用处理器303接收的AI模型在内存20中的内存20地址,导致专用处理器303根据该内存20地址发送的读指令携带的读地址为非法地址。在本申请实施例提供的访问权限控制器302中,通过访问权限控制器302对读指令进行鉴权,能够确定专用处理器303发送的读地址为非法地址,并生成指示不对AI模型进行解密的控制信号,使得无法使用计算装置0无法使用加密模型,因此能够防止恶意程序对AI模型的滥用和攻击。Because the read address in the read command sent by the dedicated processor 303 is determined according to the memory 20 address in the memory 20 of the AI model that can be carried in the task execution instruction, and when the malicious program attacks the AI model, the malicious program will modify the The AI model received by the dedicated processor 303 is at the memory 20 address in the memory 20, so that the read address carried by the read instruction sent by the dedicated processor 303 according to the memory 20 address is an illegal address. In the access authority controller 302 provided in this embodiment of the present application, the access authority controller 302 authenticates the read instruction, so that the read address sent by the dedicated processor 303 can be determined to be an illegal address, and a message indicating that the AI model is not to be decrypted can be generated. The control signal makes the computing device 0 unable to use the encryption model, so that the abuse and attack of the AI model by malicious programs can be prevented.
在另一种情况中,恶意程序不仅能够修改专用处理器303接收的AI模型在内存20中的内存20地址,还能够修改第一寄存器305中存储的AI模型的有效地址范围,此时虽然访问权限控制器302会将读地址误判为合法地址,但是由于该读地址为错误的地址,会导致根据该读地址从内存20中读出的内容不是专用控制器原本需要的AI模型,而解密电路304提供的解密密钥为原本需要的AI模型的解密密钥,因此,无法使用该解密密钥对从内存20中读出的内容进行正确的解密,仍然能够防止恶意程序对AI模型的攻击。In another case, the malicious program can not only modify the memory 20 address in the memory 20 of the AI model received by the special-purpose processor 303, but also modify the effective address range of the AI model stored in the first register 305. The authority controller 302 will misjudge the read address as a legitimate address, but because the read address is a wrong address, the content read from the memory 20 according to the read address will not be the AI model originally required by the dedicated controller, but will be decrypted. The decryption key provided by the circuit 304 is the decryption key of the originally required AI model. Therefore, the decryption key cannot be used to correctly decrypt the content read from the memory 20, which can still prevent malicious programs from attacking the AI model. .
需要说明的是,访问权限控制器302判断读地址是否为合法地址的过程、判断解密权限标识指示的内容的过程、判断AI模型是否为加密模型的过程、及判断接收的读命令是否为读指令的过程的执行顺序可以根据应用需求进行设置。图7示出了一种可能的执行顺序的示意图,如图7所示,访问权限控制器302执行鉴权操作,并根据鉴权结果生成控制信号的过程包括以下步骤:It should be noted that the access authority controller 302 judges whether the read address is a legal address, the process of judging the content indicated by the decryption authority identifier, the process of judging whether the AI model is an encryption model, and the process of judging whether the received read command is a read command. The execution order of the process can be set according to application requirements. FIG. 7 shows a schematic diagram of a possible execution sequence. As shown in FIG. 7 , the access authority controller 302 performs an authentication operation, and the process of generating a control signal according to the authentication result includes the following steps:
步骤701、访问权限控制器获取读命令。Step 701: The access authority controller obtains a read command.
步骤702、访问权限控制器接收到读命令后,判断解密权限标识指示当前计算任务使用的AI模型是否允许被解密,当解密权限标识指示当前计算任务使用的AI模型允许被解密时,执行步骤703,当解密权限标识指示当前计算任务使用的AI模型不允许被解密时,执行步骤706。Step 702: After receiving the read command, the access authority controller determines whether the decryption authority identifier indicates that the AI model used by the current computing task is allowed to be decrypted. When the decryption authority identifier indicates that the AI model used by the current computing task is allowed to be decrypted, step 703 is executed. , when the decryption authority identifier indicates that the AI model used by the current computing task is not allowed to be decrypted, step 706 is executed.
步骤703、访问权限控制器判断AI模型是否为加密模型,当AI模型为加密模型时,执行步骤704,当AI模型为非加密模型时,执行步骤706。Step 703: The access authority controller determines whether the AI model is an encrypted model. When the AI model is an encrypted model, step 704 is performed, and when the AI model is a non-encrypted model, step 706 is performed.
步骤704、访问权限控制器判断读命令是否为用于指示读取AI模型的读指令,当读命令为用于指示读取AI模型的读指令时,执行步骤705,当读命令不是用于指示读取AI模型的读指令时,执行步骤706。Step 704: The access authority controller determines whether the read command is a read command for instructing to read the AI model. When the read command is a read command for instructing to read the AI model, step 705 is executed. When the read command is not a read command for instructing When the read instruction of the AI model is read, step 706 is executed.
步骤705、访问权限控制器判断读地址是否为合法地址,当读地址为合法地址时,生成第一控制信号,当读地址为非法地址时,控制解密权限标识指示当前计算任务使用的所有AI模型均不允许被解密,并执行步骤706。Step 705: The access authority controller judges whether the read address is a legal address, and when the read address is a legal address, generates a first control signal, and when the read address is an illegal address, controls the decryption authority identifier to indicate all AI models used by the current computing task Neither are allowed to be decrypted, and step 706 is executed.
步骤706、访问权限控制器生成第二控制信号。Step 706: The access authority controller generates a second control signal.
其中,当以上任意一个判断条件不满足时,访问权限控制器生成第二控制信号,则无需 根据其他判断条件进行判断,能够减小访问权限控制器的工作量,保证鉴权效率。并且,当鉴权过程按照上述先根据解密权限标识进行判断,再判断AI模型是否为加密模型,再判断读命令是否为读指令,再判断读地址是否为合法地址,能够根据判断条件从粗粒度到细粒度实现判断,能够进一步保证鉴权效率。Wherein, when any one of the above judgment conditions is not satisfied, the access authority controller generates the second control signal, and there is no need to judge according to other judgment conditions, which can reduce the workload of the access authority controller and ensure the authentication efficiency. In addition, when the authentication process is first judged according to the above-mentioned decryption authority identifier, then judge whether the AI model is an encryption model, then judge whether the read command is a read command, and then judge whether the read address is a legal address, which can be based on the judgment conditions from coarse-grained. To achieve fine-grained judgment, the authentication efficiency can be further guaranteed.
另外,如图4所示,模型保护装置30还可以包括:密钥生成电路306。密钥生成电路306用于获取模型保护装置30的根密钥、AI模型的版本标识和模型保护装置30的装置标识,基于根密钥、版本标识和装置标识,生成用于对AI模型进行解密的解密密钥。可选的,驱动模块10向内存20中存储AI模型后,可以向密钥生成电路306发送指示生成解密秘钥的指示,即该密钥生成电路306用于在该驱动模块10的指示下生成解密密钥。或者,密钥生成电路306生成解密密钥的过程可以在内存20中存储AI模型之前生成。例如,在计算装置0的非易失性存储介质中烧写AI模型后,该密钥生成电路306即可生成该AI模型的解密秘钥,以便后续解密使用。In addition, as shown in FIG. 4 , the model protection device 30 may further include: a key generation circuit 306 . The key generation circuit 306 is used to obtain the root key of the model protection device 30, the version identification of the AI model and the device identification of the model protection device 30, and based on the root key, the version identification and the device identification, generate a device for decrypting the AI model. decryption key. Optionally, after the drive module 10 stores the AI model in the memory 20, it can send an instruction to the key generation circuit 306 to instruct to generate a decryption key, that is, the key generation circuit 306 is used to generate the decryption key under the instruction of the drive module 10. decryption key. Alternatively, the process of generating the decryption key by the key generation circuit 306 may be generated before the AI model is stored in the memory 20 . For example, after the AI model is programmed in the non-volatile storage medium of the computing device 0, the key generation circuit 306 can generate a decryption key of the AI model for subsequent decryption and use.
其中,为了保证能够使用该解密密钥对AI模型进行解密,该密钥生成电路306基于根密钥、版本标识和装置标识生成解密密钥的实现方式,需要与基于根密钥、版本标识和装置标识,生成用于对AI模型进行加密的加密密钥的实现方式保持一致。例如,生成解密密钥的算法和生成加密密钥的算法可以相同。Wherein, in order to ensure that the AI model can be decrypted using the decryption key, the key generation circuit 306 generates a decryption key based on the root key, the version ID and the device ID. The device identification and the implementation manner of generating the encryption key used to encrypt the AI model shall be consistent. For example, the algorithm for generating the decryption key and the algorithm for generating the encryption key may be the same.
并且,如图4所示,模型保护装置30还包括:第二寄存器307,第二寄存器307用于存储解密密钥。密钥生成电路306生成解密密钥后,可以将该解密密钥存储在该第二寄存器307中。此时,模型保护装置30中的解密电路304具体用于从第二寄存器307中读取解密密钥,在控制信号的指示下,采用读取的解密密钥对AI模型解密。其中,解密电路304对AI模型进行解密时,若解密密钥与对AI模型进行加密的加密密钥相同,则解密电路304能够使用解密密钥对AI模型成功解密,若解密密钥与对AI模型进行加密的加密密钥不同,则无法实现对AI模型的解密。And, as shown in FIG. 4 , the model protection device 30 further includes: a second register 307, and the second register 307 is used for storing the decryption key. After the key generation circuit 306 generates the decryption key, the decryption key may be stored in the second register 307 . At this time, the decryption circuit 304 in the model protection device 30 is specifically configured to read the decryption key from the second register 307, and under the instruction of the control signal, use the read decryption key to decrypt the AI model. When the decryption circuit 304 decrypts the AI model, if the decryption key is the same as the encryption key used to encrypt the AI model, the decryption circuit 304 can use the decryption key to successfully decrypt the AI model. If the encryption key used to encrypt the model is different, the AI model cannot be decrypted.
下面以模型保护装置30的根密钥和模型保护装置30的装置标识由芯片厂商提供,AI模型的版本标识由模型厂商分配,模型厂商的操作由第一计算机设备执行,芯片厂商的操作由第二计算机设备执行,终端厂商的操作由第三计算机设备执行为例,对生成AI模型的加密密钥、AI模型的加密和解密过程的实现方式进行说明。其中,模型厂商的操作可以由一个或多个计算机设备执行,该一个或多个计算机设备可以统称为第一计算机设备。类似的,芯片厂商的操作可以由一个或多个计算机设备执行,该一个或多个计算机设备统称为第二计算机设备。终端厂商的操作可以由一个或多个计算机设备执行,该一个或多个计算机设备统称为第三计算机设备。如图8,该实现过程包括以下步骤:In the following, the root key of the model protection device 30 and the device ID of the model protection device 30 are provided by the chip manufacturer, the version ID of the AI model is distributed by the model manufacturer, the operation of the model manufacturer is performed by the first computer equipment, and the operation of the chip manufacturer is performed by the first computer device. The second computer device performs the operation of the terminal manufacturer, and the operation of the terminal manufacturer is performed by the third computer device. As an example, the generation of the encryption key of the AI model and the implementation of the encryption and decryption process of the AI model are described. The operation of the model maker may be performed by one or more computer devices, and the one or more computer devices may be collectively referred to as the first computer device. Similarly, the operations of the chip manufacturer may be performed by one or more computer devices, which are collectively referred to as second computer devices. The operations of the terminal manufacturer may be performed by one or more computer devices, which are collectively referred to as third computer devices. As shown in Figure 8, the implementation process includes the following steps:
步骤801、第一计算机设备获取AI模型的模型厂商标识和模型保护装置的根密钥。Step 801: The first computer device acquires the model manufacturer ID of the AI model and the root key of the model protection device.
可选地,第一计算机设备可以生成模型厂商标识,并根据该模型厂商标识生成根密钥,以得到模型厂商标识和根密钥。或者,第一计算机设备可以向第二计算机设备请求分配根密钥,第二计算机设备可以根据第一计算机设备的请求为模型厂商分配模型厂商标识,然后根据该模型厂商标识生成根密钥,并将根密钥和模型厂商标识发送至第一计算机设备。其中,芯片厂商通常为模型厂商的可信方,因此,如图9所示,模型厂商标识通常由芯片厂商向模型厂商分配,且根密钥通常根据该模型厂商标识和芯片厂商提供的基础根密钥生成。Optionally, the first computer device may generate a model manufacturer identification, and generate a root key according to the model manufacturer identification, so as to obtain the model manufacturer identification and the root key. Alternatively, the first computer device may request the second computer device to distribute a root key, and the second computer device may assign a model manufacturer identifier to a model manufacturer according to the request of the first computer device, and then generate a root key according to the model manufacturer identifier, and The root key and model manufacturer identification are sent to the first computer device. Among them, the chip manufacturer is usually the trusted party of the model manufacturer. Therefore, as shown in Figure 9, the model manufacturer ID is usually assigned by the chip manufacturer to the model manufacturer, and the root key is usually based on the model manufacturer ID and the basic root provided by the chip manufacturer. key generation.
并且,为保证模型厂商标识和根密钥的安全性,根密钥和模型厂商标识可以通过打包并 加密的方式发送至第一计算机设备。可选地,对模型厂商标识和根密钥进行加密的方式可以为PGP(pretty good privacy)加密方式。在一种可实现方式中,根据模型厂商标识生成根密钥的过程可以使用运行在安全环境中的服务器离线执行。例如,该运行在安全环境中的服务器可以为硬件安全模块(hardware security modules,HSM)。In addition, in order to ensure the security of the model manufacturer identification and the root key, the root key and the model manufacturer identification can be sent to the first computer device in a packaged and encrypted manner. Optionally, the method of encrypting the model manufacturer ID and the root key may be a PGP (pretty good privacy) encryption method. In one implementation, the process of generating the root key according to the model vendor identification can be performed offline using a server running in a secure environment. For example, the servers running in the secure environment may be hardware security modules (HSMs).
进一步地,为了能够安全地存储根密钥,可以将该根密钥预置在模型保护装置30的非易失性存储介质中。例如,可以将根密钥存储在一次性可编程(one time programmable,OTP)存储介质中,由于该OTP存储介质只能支持写入一次数据,当恶意程序篡改该OTP存储介质中存储的根密钥时,由于无法再次写入该OTP存储介质,因此能够保证该根密钥的安全性。Further, in order to be able to securely store the root key, the root key may be preset in the non-volatile storage medium of the model protection device 30 . For example, the root key can be stored in a one-time programmable (OTP) storage medium. Since the OTP storage medium can only support writing data once, when a malicious program tampers with the root key stored in the OTP storage medium When the key is used, since the OTP storage medium cannot be written again, the security of the root key can be guaranteed.
步骤802、第三计算机设备获取模型保护装置的装置标识,并向第一计算机设备发送模型保护装置的装置标识。Step 802: The third computer device acquires the device identifier of the model protection device, and sends the device identifier of the model protection device to the first computer device.
终端厂商提供的计算装置0中部署有本申请实施例提供的模型保护装置30,该模型保护装置30用于实现AI模型。该模型保护装置30中内置有装置标识,第三计算机设备可以通过模型保护装置30上的应用程序接口,读取该模型保护装置30的装置标识,并向第一计算机设备发送该装置标识。其中,当该模型保护装置30为计算芯片时,该装置标识为该计算芯片的芯片标识。The model protection device 30 provided by the embodiment of the present application is deployed in the computing device 0 provided by the terminal manufacturer, and the model protection device 30 is used to implement the AI model. The model protector 30 has a built-in device identifier, and the third computer device can read the device identifier of the model protector 30 through the application program interface on the model protector 30 and send the device identifier to the first computer device. Wherein, when the model protection device 30 is a computing chip, the device identification is the chip identification of the computing chip.
在一种可实现方式中,该装置标识可以存储在模型保护装置30的非易失性存储介质中。例如,该装置标识可以存储在OTP存储介质中,由于该OTP存储介质只能支持写入一次数据,当恶意程序篡改该OTP存储介质中存储的装置标识时,由于无法再次写入该OTP存储介质,因此能够保证该装置标识的安全性。In one implementation, the device identification may be stored in a non-volatile storage medium of model protector 30 . For example, the device identifier can be stored in an OTP storage medium. Since the OTP storage medium can only support writing data once, when a malicious program tampers with the device identifier stored in the OTP storage medium, the OTP storage medium cannot be written again because the OTP storage medium cannot be written again. , so the security of the device identification can be guaranteed.
步骤803、第一计算机设备为AI模型分配版本标识,根据模型保护装置的装置标识、AI模型的版本标识和模型保护装置的根密钥,生成AI模型的加密密钥。Step 803: The first computer device assigns a version identifier to the AI model, and generates an encryption key for the AI model according to the device identifier of the model protection device, the version identifier of the AI model, and the root key of the model protection device.
模型厂商为对其不同的AI模型进行区分,如图9所示,模型厂商可以通过第一计算机设备为不同的AI模型分别分配版本标识。并且,如图9所示,模型厂商可以根据获取的装置标识、根密钥和版本标识,生成AI模型的加密密钥。在一种可实现方式中,芯片厂商可以为模型厂商提供用于生成加密密钥的密钥生成单元,且该密钥生成单元可以通过软件实现或硬件实现,模型厂商可以过将版本标识、装置标识和根密钥输入至生成工具,并接收该生成工具的输出,得到AI模型的加密密钥。并且,如图9所示,在生成加密密钥时,可以由密钥生成单元先根据根密钥和版本标识生成一个中间密钥,再根据该中间密钥和装置标识生成加密密钥。In order for the model manufacturer to distinguish different AI models, as shown in FIG. 9 , the model manufacturer may assign version identifiers to different AI models through the first computer device. Moreover, as shown in FIG. 9 , the model manufacturer can generate the encryption key of the AI model according to the acquired device ID, root key and version ID. In an implementation manner, the chip manufacturer can provide the model manufacturer with a key generation unit for generating an encryption key, and the key generation unit can be implemented by software or hardware, and the model manufacturer can identify the version, device The identification and root key are input to the generation tool, and the output of the generation tool is received to obtain the encryption key of the AI model. Moreover, as shown in FIG. 9 , when generating the encryption key, the key generation unit may first generate an intermediate key according to the root key and the version identifier, and then generate the encryption key according to the intermediate key and the device identifier.
由于加密秘钥根据装置标识、根密钥和版本标识得到,当装置标识、根密钥和版本标识中的任一个不同时,得到的加密秘钥不同。并且,由于不同模型保护装置30的装置标识不同,使得根据不同模型保护装置30的装置标识生成的加密密钥不同,因此能够使用不同的模型保护装置30保护不同的AI模型。并且,当使用同一模型保护装置30保护同一模型厂商提供的多个AI模型时,可以根据模型厂商的意愿,使控制该多个AI模型的加密密钥相同或不同。例如,当使用同一模型保护装置30保护多个AI模型时,模型厂商可以为该多个AI模型分配相同的版本标识,且由于该多个AI模型的模型厂商为同一个,而根密钥是根据AI模型的模型厂商标识生成,即用于生成该多个AI模型的加密密钥的装置标识、版本标识和根密钥分别对应相同,因此该多个AI模型的加密密钥相同。Since the encryption key is obtained according to the device ID, the root key and the version ID, when any one of the device ID, the root key and the version ID is different, the obtained encryption keys are different. In addition, since the device identifiers of different model protectors 30 are different, the encryption keys generated according to the device identifiers of different model protectors 30 are different, so different model protectors 30 can be used to protect different AI models. In addition, when the same model protection device 30 is used to protect multiple AI models provided by the same model manufacturer, the encryption keys for controlling the multiple AI models can be the same or different according to the model manufacturer's wishes. For example, when using the same model protection device 30 to protect multiple AI models, the model manufacturer can assign the same version identifier to the multiple AI models, and since the model manufacturer of the multiple AI models is the same, and the root key is Generated according to the model manufacturer identifiers of the AI models, that is, the device identifiers, version identifiers and root keys used to generate the encryption keys of the multiple AI models correspond to the same respectively, so the encryption keys of the multiple AI models are the same.
步骤804、第一计算机设备使用加密密钥对AI模型加密,向第三计算机设备发送加密后 的AI模型,并向第三计算机设备发送模型厂商标识和版本标识。 Step 804, the first computer equipment uses the encryption key to encrypt the AI model, sends the encrypted AI model to the third computer equipment, and sends the model manufacturer identification and version identification to the third computer equipment.
如图9所示,第一计算机设备获取AI模型的加密密钥后,可以使用该加密密钥对明文存储的AI模型(也称明文模型)进行加密,并在终端厂商购买模型厂商的AI模型后,将加密后的AI模型发送至终端厂商。并且,为了便于终端厂商的计算装置0能够对该加密后的AI模型进行解密,模型厂商还需要向终端厂商发送AI模型的版本标识和模型厂商标识。或者,模型厂商向终端厂商发送模型保护装置30的根密钥和AI模型版本标识。As shown in FIG. 9 , after the first computer device obtains the encryption key of the AI model, it can use the encryption key to encrypt the AI model (also called the plaintext model) stored in plaintext, and purchase the AI model of the model manufacturer from the terminal manufacturer. After that, the encrypted AI model is sent to the terminal manufacturer. In addition, in order to facilitate the computing device 0 of the terminal manufacturer to decrypt the encrypted AI model, the model manufacturer also needs to send the version identifier of the AI model and the model manufacturer identifier to the terminal manufacturer. Or, the model manufacturer sends the root key of the model protection device 30 and the AI model version identifier to the terminal manufacturer.
步骤805、第三计算机设备将加密后的AI模型烧写到计算装置的非易失性存储介质中,并将模型厂商标识和版本标识存储在计算装置的非易失性存储介质中。Step 805: The third computer device burns the encrypted AI model into the non-volatile storage medium of the computing device, and stores the model manufacturer ID and version ID in the non-volatile storage medium of the computing device.
第三计算机设备获取加密后的AI模型后,可以将该加密后的AI模型烧写到计算装置0的非易失性存储介质中。可选地,第三计算机设备可以在产线上将包括有加密后的AI模型的镜像文件烧写到计算装置0的非易失存储介质中。并将模型厂商标识和版本标识存储在该计算装置0的非易失性存储介质中。其中,该非易失性存储介质可以为快闪存储器(flash memory)、硬盘(hard disk drive,HDD)或固态硬盘(solid-state drive,SSD)等。After acquiring the encrypted AI model, the third computer device may program the encrypted AI model into the non-volatile storage medium of the computing device 0 . Optionally, the third computer device may burn the image file including the encrypted AI model into the non-volatile storage medium of the computing device 0 on the production line. The model manufacturer ID and version ID are stored in the non-volatile storage medium of the computing device 0 . Wherein, the non-volatile storage medium may be a flash memory (flash memory), a hard disk drive (hard disk drive, HDD), or a solid-state drive (solid-state drive, SSD) or the like.
步骤806、密钥生成电路从计算装置的非易失存储介质中获取模型厂商标识、版本标识和装置标识。Step 806: The key generation circuit acquires the model manufacturer ID, version ID and device ID from the non-volatile storage medium of the computing device.
由于模型保护装置30中内置有模型保护装置30的装置标识,第三计算机设备可以读取该装置标识,并向密钥生成电路306提供该装置标识。且计算装置0的非易失性存储介质中存储有模型厂商标识model_owner_id和版本标识,密钥生成电路306可以获取该模型厂商标识和版本标识。Since the device identification of the model protection device 30 is built in the model protection device 30 , the third computer device can read the device identification and provide the key generation circuit 306 with the device identification. In addition, the non-volatile storage medium of the computing device 0 stores the model manufacturer ID model_owner_id and the version ID, and the key generation circuit 306 can obtain the model manufacturer ID and version ID.
步骤807、密钥生成电路根据模型厂商标识、版本标识和装置标识,生成解密密钥,将解密秘钥存储在第二寄存器中。Step 807: The key generation circuit generates a decryption key according to the model manufacturer ID, version ID and device ID, and stores the decryption key in the second register.
如图9所示,密钥生成电路306可以根据模型厂商标识生成模型保护装置30的根密钥,并根据该根密钥、模型保护装置30的装置标识和AI模型的版本标识生成解密密钥。在一种可实现方式中,由于密钥生成电路306由提供模型保护装置30的芯片厂商提供,该密钥生成电路306能够获取芯片厂商提供的基础根密钥,并根据该模型厂商标识和芯片厂商提供的基础根密钥生成根密钥。并且,为了保证能够使用该解密密钥对AI模型进行解密,该密钥生成电路306生成解密密钥的实现方式,需要与第一计算机设备生成加密密钥的实现方式保持一致。例如,生成解密密钥的算法和生成加密密钥的算法可以相同。另外,如图9所示,在生成解密密钥时,可以由密钥生成电路先根据根密钥和版本标识生成一个中间密钥,再根据该中间密钥和装置标识生成解密密钥。As shown in FIG. 9 , the key generation circuit 306 can generate the root key of the model protector 30 according to the model manufacturer ID, and generate the decryption key according to the root key, the device ID of the model protector 30 and the version ID of the AI model . In an implementation manner, since the key generation circuit 306 is provided by the chip manufacturer that provides the model protection device 30, the key generation circuit 306 can obtain the basic root key provided by the chip manufacturer, and obtain the basic root key provided by the chip manufacturer according to the model manufacturer ID and the chip manufacturer. The base root key provided by the manufacturer generates the root key. In addition, in order to ensure that the AI model can be decrypted using the decryption key, the implementation manner of the key generation circuit 306 generating the decryption key needs to be consistent with the implementation manner of the first computer device to generate the encryption key. For example, the algorithm for generating the decryption key and the algorithm for generating the encryption key may be the same. In addition, as shown in FIG. 9 , when generating the decryption key, the key generation circuit may first generate an intermediate key according to the root key and the version identifier, and then generate the decryption key according to the intermediate key and the device identifier.
当根据模型厂商标识生成根密钥时,根据模型厂商标识生成根密钥,再根据根密钥生成解密密钥的过程,相较于根据根密钥直接生成解密密钥的过程,需要多执行一次生成过程,能够进一步地保证密钥的安全性。When generating the root key according to the model manufacturer ID, the process of generating the root key according to the model manufacturer ID, and then generating the decryption key according to the root key requires more execution than the process of directly generating the decryption key according to the root key. One generation process can further ensure the security of the key.
当步骤804中模型厂商向终端厂商发送根密钥和版本标识时,在该步骤807中,密钥生成电路306可以直接根据该根密钥、版本标识和装置标识生成解密密钥。When the model manufacturer sends the root key and version identifier to the terminal manufacturer in step 804, in step 807, the key generation circuit 306 can directly generate a decryption key according to the root key, version identifier and device identifier.
步骤808、解密电路从第二寄存器中获取该解密密钥,根据该解密密钥对加密后的AI模型进行解密。Step 808: The decryption circuit obtains the decryption key from the second register, and decrypts the encrypted AI model according to the decryption key.
如图9所示,解密电路获取解密密钥后,可以对加密后的AI模型执行解密操作,以得到明文模型。As shown in FIG. 9 , after the decryption circuit obtains the decryption key, the decryption operation can be performed on the encrypted AI model to obtain the plaintext model.
其中,图9中虚线框表示通过硬件或者经过处理的软件实现的操作,其实现逻辑无法通过软件干预或篡改,实线框表示通过软件实现的操作。其中,经过处理的软件是指通过对软件执行固化等处理,使得经过处理的软件无法被干预或篡改。从该图9中可以看出,模型保护装置30的装置标识和根秘钥都是无法被篡改的,因此,根据该根秘钥和装置标识生成的加密秘钥,并使用该加密秘钥对AI模型进行保护,能够实现对AI模型的保护。Wherein, the dotted box in FIG. 9 represents an operation implemented by hardware or processed software, and its implementation logic cannot be intervened or tampered with by software, and the solid-line box represents an operation implemented by software. The processed software refers to processing such as curing the software so that the processed software cannot be interfered or tampered with. As can be seen from FIG. 9 , the device ID and root key of the model protection device 30 cannot be tampered with. Therefore, the encryption key generated according to the root key and the device ID is used to use the encryption key pair. The AI model can be protected to protect the AI model.
需要说明的是,本申请实施例提供的模型保护装置的实际形态可以根据应用需求进行设置。例如,该模型保护装置的实际形态可以为片上系统(system on chip,SOC),该模型保护装置可以由电路等硬件方式实现。并且,该片上系统可以是运行在安全环境(safe environment,SE)中的芯片。并且,该模型保护装置可以根据需求选择使用硬件实现或使用硬件与软件结合的方式实现。当该模型保护装置通过硬件实现时,由于硬件制造完成后,由该硬件实现的逻辑无法被改变,能够防止终端厂商或恶意程序等对该模型保护装置的实现逻辑进行篡改,从而实现对AI模型的有效保护。当该模型保护装置通过硬件与软件结合的方式实现时,可以对用于实现模型保护装置的软件执行指定手段,以保证终端厂商或恶意程序等无法对该模型保护装置的实现逻辑进行篡改,从而实现对AI模型的有效保护。It should be noted that, the actual form of the model protection device provided in the embodiments of the present application may be set according to application requirements. For example, the actual form of the model protection device may be a system on chip (system on chip, SOC), and the model protection device may be implemented by hardware such as a circuit. Also, the SoC may be a chip running in a safe environment (SE). Moreover, the model protection device can be implemented by hardware or by a combination of hardware and software according to requirements. When the model protection device is implemented by hardware, since the logic implemented by the hardware cannot be changed after the hardware is manufactured, it can prevent terminal manufacturers or malicious programs from tampering with the implementation logic of the model protection device, thereby realizing the AI model. effective protection. When the model protection device is realized by a combination of hardware and software, the software used to realize the model protection device can execute a specified means to ensure that the terminal manufacturer or malicious programs cannot tamper with the realization logic of the model protection device, thereby Achieve effective protection of AI models.
示例地,当该模型保护装置通过硬件与软件结合的方式实现时,该模型保护装置中的专用处理器、内存控制器、第一寄存器和第二寄存器等实现的功能可以通过硬件实现,访问权限控制器、解密电路和密钥生成电路等实现的功能可以通过软件实现。例如,访问权限控制器的功能通过访问权限控制模块实现,解密电路的功能通过解密模块实现,密钥生成电路的功能通过密钥生成模块实现,且以上模块的功能均可以通过处理器执行计算机程序实现。For example, when the model protection device is implemented by a combination of hardware and software, the functions implemented by the dedicated processor, the memory controller, the first register and the second register in the model protection device can be implemented by hardware, and the access rights The functions implemented by the controller, the decryption circuit, and the key generation circuit can be implemented by software. For example, the function of the access authority controller is realized by the access authority control module, the function of the decryption circuit is realized by the decryption module, the function of the key generation circuit is realized by the key generation module, and the functions of the above modules can all be executed by the processor. accomplish.
综上所述,在本申请实施例提供的模型保护装置中,通过访问权限控制器对读指令进行鉴权,能够生成指示是否对从内存中读取的AI模型进行解密,当该AI模型以加密模型的形式存储在内存中时,若控制信号指示对该AI模型进行解密,才有可能成功使用该AI模型,若控制信号指示不对该AI模型进行解密,则无法使用该AI模型。因此,通过对AI模型进行解密的过程进行控制,能够防止AI的拷贝、泄露和滥用,实现对该AI模型的保护,有助于建立完善的AI模型生态,构筑安全合理的盈利模式。并且,本申请实施例提供的一种模型保护装置能够在单个SOC上实现,不需要耗费额外的SOC成本以及不同SOC芯片之间进行交互的成本,能够使用较低的成本实现对AI模型的安全保护。同时,通过对读指令进行鉴权实现对AI模型的保护,还提供了一种对指令做合法性检查的技术,能够将本申请实施例通过对指令做合法性检查的技术应用在类似的需要做权限检查的场景中。To sum up, in the model protection device provided by the embodiment of the present application, the access authority controller authenticates the read instruction, and can generate an indication whether to decrypt the AI model read from the memory. When the encrypted model is stored in the memory, if the control signal indicates that the AI model is decrypted, it is possible to use the AI model successfully. If the control signal indicates that the AI model is not decrypted, the AI model cannot be used. Therefore, by controlling the process of decrypting the AI model, it can prevent the copying, leaking and misuse of AI, realize the protection of the AI model, help to establish a perfect AI model ecology, and build a safe and reasonable profit model. In addition, a model protection device provided by the embodiment of the present application can be implemented on a single SOC, does not require additional SOC cost and the cost of interaction between different SOC chips, and can realize the security of the AI model at a lower cost. Protect. At the same time, the protection of the AI model is realized by authenticating the read command, and a technology for checking the validity of the command is also provided, so that the embodiment of the present application can be applied to similar needs through the technology of checking the validity of the command. In scenarios where permission checks are performed.
本申请实施例提供了一种模型保护方法。该模型保护方法应用于模型保护装置,该模型保护装置包括:访问权限控制器和内存控制器。例如,该模型保护方法可以应用于本申请实施例提供的前述模型保护装置。The embodiment of the present application provides a model protection method. The model protection method is applied to a model protection device, and the model protection device includes an access authority controller and a memory controller. For example, the model protection method can be applied to the aforementioned model protection device provided in the embodiments of the present application.
在该模型保护方法中,访问权限控制器可以获取读指令,对读指令执行鉴权操作,并基于鉴权结果生成控制信号,将读指令发送至内存控制器,内存控制器可以基于读指令从内存中读取AI模型。这样一来,访问权限控制器能够通过对AI模型进行解密的过程进行控制,防止AI的泄露和滥用,实现对AI模型的保护。In the model protection method, the access authority controller can obtain the read command, perform an authentication operation on the read command, generate a control signal based on the authentication result, and send the read command to the memory controller, and the memory controller can Read AI models in memory. In this way, the access authority controller can control the process of decrypting the AI model, preventing the leakage and abuse of the AI, and realizing the protection of the AI model.
下面以该模型保护方法应用于图4所示的模型保护装置为例,对该模型保护方法的实现过程进行说明。如图10所示,该模型保护方法包括:The implementation process of the model protection method is described below by taking the application of the model protection method to the model protection device shown in FIG. 4 as an example. As shown in Figure 10, the model protection method includes:
步骤1001、专用处理器生成读指令,并将读指令发送至访问权限控制器。 Step 1001, the dedicated processor generates a read instruction, and sends the read instruction to the access authority controller.
步骤1002、访问权限控制器获取读指令中包含的用于读取AI模型的读地址,基于读地址对读指令执行鉴权操作,基于鉴权结果生成控制信号,将读指令发送至内存控制器。 Step 1002, the access authority controller obtains the read address for reading the AI model included in the read instruction, performs an authentication operation on the read instruction based on the read address, generates a control signal based on the authentication result, and sends the read instruction to the memory controller .
其中,控制信号包括第一控制信号和第二控制信号,第一控制信号用于指示对AI模型进行解密,第二控制信号用于指示不对AI模型进行解密。The control signal includes a first control signal and a second control signal, the first control signal is used to instruct the AI model to be decrypted, and the second control signal is used to instruct not to decrypt the AI model.
在一种可实现方式中,访问权限控制器基于鉴权结果生成控制信号,包括:当读地址为合法地址时,访问权限控制器生成第一控制信号;当读地址为非法地址时,访问权限控制器生成第二控制信号。In an implementation manner, the access authority controller generates a control signal based on the authentication result, including: when the read address is a legal address, the access authority controller generates a first control signal; when the read address is an illegal address, the access authority The controller generates the second control signal.
在另一种可实现方式中,控制信号包括第一控制信号和第二控制信号,第一控制信号用于指示对AI模型进行解密,第二控制信号用于指示不对AI模型进行解密,模型保护装置中存储有解密权限标识,解密权限标识用于指示当前计算任务使用的AI模型是否允许被解密,访问权限控制器基于鉴权结果生成控制信号,包括:当读地址为合法地址且满足指定条件时,访问权限控制器生成第一控制信号;当读地址为非法地址,和/或,不满足指定条件时,访问权限控制器生成第二控制信号。其中,指定条件包括以下至少一个:解密权限标识指示当前计算任务使用的AI模型允许被解密;或,AI模型为加密模型。In another implementation manner, the control signal includes a first control signal and a second control signal, the first control signal is used to instruct the AI model to be decrypted, the second control signal is used to instruct not to decrypt the AI model, and the model is protected. A decryption authority identifier is stored in the device, and the decryption authority identifier is used to indicate whether the AI model used by the current computing task is allowed to be decrypted. The access authority controller generates a control signal based on the authentication result, including: when the read address is a legal address and meets the specified conditions When , the access authority controller generates a first control signal; when the read address is an illegal address, and/or when the specified condition is not met, the access authority controller generates a second control signal. The specified condition includes at least one of the following: the decryption permission identifier indicates that the AI model used by the current computing task is allowed to be decrypted; or, the AI model is an encryption model.
可选地,模型保护装置还包括:第一寄存器,第一寄存器用于存储AI模型在内存中的有效地址范围,访问权限控制器对读指令执行鉴权操作,包括:访问权限控制器从第一寄存器中读取有效地址范围,基于有效地址范围和读地址对读指令执行鉴权操作。Optionally, the model protection device further includes: a first register, where the first register is used to store the effective address range of the AI model in the memory, and the access authority controller performs an authentication operation on the read instruction, including: the access authority controller starts from the first register. A valid address range is read from a register, and an authentication operation is performed on the read command based on the valid address range and the read address.
可选地,在访问权限控制器对读指令执行鉴权操作之后,模型保护方法还包括:当读地址为非法地址时,访问权限控制器控制解密权限标识指示当前计算任务使用的所有AI模型均不允许被解密。Optionally, after the access authority controller performs an authentication operation on the read instruction, the model protection method further includes: when the read address is an illegal address, the access authority controller controls the decryption authority identifier to indicate that all AI models used by the current computing task are Decryption is not allowed.
可选地,在访问权限控制器对读指令执行鉴权操作之后,模型保护方法还包括:在完成当前计算任务后,访问权限控制器将解密权限标识重置为指示允许解密。Optionally, after the access authority controller performs an authentication operation on the read instruction, the model protection method further includes: after completing the current computing task, the access authority controller resets the decryption authority identifier to indicate that decryption is permitted.
步骤1003、内存控制器基于读指令从内存中读取AI模型,并向解密电路提供AI模型。 Step 1003, the memory controller reads the AI model from the memory based on the read instruction, and provides the AI model to the decryption circuit.
步骤1004、解密电路接收访问权限控制器生成的控制信号,并在控制信号的指示下,对AI模型进行解密后传输给专用处理器,或者,在控制信号的指示下,向专用处理器透传AI模型。Step 1004: The decryption circuit receives the control signal generated by the access authority controller, and under the instruction of the control signal, decrypts the AI model and transmits it to the dedicated processor, or, under the instruction of the control signal, transparently transmits it to the dedicated processor AI model.
可选地,模型保护装置还包括:密钥生成电路。模型保护方法还包括:密钥生成电路获取模型保护装置的根密钥、AI模型的版本标识和模型保护装置的装置标识,基于根密钥、版本标识和装置标识,生成用于对AI模型进行解密的解密密钥。Optionally, the model protection device further includes: a key generation circuit. The model protection method further includes: the key generation circuit obtains the root key of the model protection device, the version identification of the AI model and the device identification of the model protection device, and based on the root key, the version identification and the device identification, generates a method for performing the execution of the AI model. Decrypted decryption key.
可选地,模型保护装置还包括:第二寄存器,第二寄存器用于存储解密密钥,在访问权限控制器基于鉴权结果生成控制信号之后,模型保护方法还包括:模型保护装置中的解密电路从第二寄存器中读取解密密钥,在控制信号的指示下,采用解密密钥对AI模型解密。Optionally, the model protection device further includes: a second register, where the second register is used to store a decryption key, and after the access authority controller generates a control signal based on the authentication result, the model protection method further includes: decryption in the model protection device The circuit reads the decryption key from the second register, and uses the decryption key to decrypt the AI model under the instruction of the control signal.
其中,驱动模块10向内存20中存储AI模型后,可以向密钥生成电路306发送指示生成解密秘钥的指示,即该密钥生成电路生成解密密钥的操作在该驱动模块10的指示下开始执行。或者,密钥生成电路306生成解密密钥的过程可以在内存20中存储AI模型之前生成。例如,在计算装置0的非易失性存储介质中烧写AI模型后,该密钥生成电路306即可生成该AI模型的解密秘钥,以便后续解密使用。Wherein, after the drive module 10 stores the AI model in the memory 20, it can send an instruction to the key generation circuit 306 to instruct to generate a decryption key, that is, the operation of the key generation circuit to generate the decryption key is under the instruction of the drive module 10 start execution. Alternatively, the process of generating the decryption key by the key generation circuit 306 may be generated before the AI model is stored in the memory 20 . For example, after the AI model is programmed in the non-volatile storage medium of the computing device 0, the key generation circuit 306 can generate a decryption key of the AI model for subsequent decryption and use.
步骤1005、专用处理器基于解密电路传输的AI模型,执行当前计算任务。Step 1005: The dedicated processor executes the current computing task based on the AI model transmitted by the decryption circuit.
需要说明的是,本申请实施例提供的模型保护方法步骤的先后顺序可以进行适当调整,步骤也可以根据情况进行相应增减,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化的方法,都应涵盖在本申请的保护范围之内,因此不再赘述。It should be noted that the sequence of steps of the model protection method provided by the embodiments of the present application can be appropriately adjusted, and the steps can also be correspondingly increased or decreased according to the situation. Any person skilled in the art is within the technical scope disclosed in this application, Changes in methods that can be easily thought of should be covered within the scope of protection of the present application, and thus will not be repeated here.
综上所述,在本申请实施例提供的模型保护方法中,通过访问权限控制器对读指令进行鉴权,能够生成指示是否对从内存中读取的AI模型进行解密,当该AI模型以加密模型的形式存储在内存中时,若控制信号指示对该AI模型进行解密,才有可能成功使用该AI模型,若控制信号指示不对该AI模型进行解密,则无法使用该AI模型。因此,通过对AI模型进行解密的过程进行控制,能够防止AI的拷贝、泄露和滥用,实现对该AI模型的保护,有助于建立完善的AI模型生态,构筑安全合理的盈利模式。并且,本申请实施例提供的一种模型保护装置能够在单个SOC上实现,不需要耗费额外的SOC成本以及不同SOC芯片之间进行交互的成本,能够使用较低的成本实现对AI模型的安全保护。同时,通过对读指令进行鉴权实现对AI模型的保护,还提供了一种对指令做合法性检查的技术,能够将本申请实施例通过对指令做合法性检查的技术应用在类似的需要做权限检查的场景中。To sum up, in the model protection method provided in the embodiment of the present application, the read instruction is authenticated by the access authority controller, and an indication of whether to decrypt the AI model read from the memory can be generated. When the encrypted model is stored in the memory, if the control signal indicates that the AI model is decrypted, it is possible to use the AI model successfully. If the control signal indicates that the AI model is not decrypted, the AI model cannot be used. Therefore, by controlling the process of decrypting the AI model, it can prevent the copying, leaking and misuse of AI, realize the protection of the AI model, help to establish a perfect AI model ecology, and build a safe and reasonable profit model. In addition, a model protection device provided by the embodiment of the present application can be implemented on a single SOC, does not require additional SOC cost and the cost of interaction between different SOC chips, and can realize the security of the AI model at a lower cost. Protect. At the same time, the protection of the AI model is realized by authenticating the read command, and a technology for checking the validity of the command is also provided, so that the embodiment of the present application can be applied to similar needs through the technology of checking the validity of the command. In scenarios where permission checks are performed.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的模型保护方法中各个器件的实现方式和具体工作过程,可以相应参考本申请实施例提供的前述模型保护装置中的对应内容,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of description, for the implementation manner and specific working process of each device in the model protection method described above, reference may be made to the model protection device provided in the embodiment of the present application. The corresponding content is not repeated here.
本申请实施例提供了一种计算机设备。如图11所示,该计算机设备1100包括处理器1110,通信接口1120和存储器1130。该处理器1110,通信接口1120和存储器1130之间通过总线1140相互连接。存储器1130中存储有计算机程序。处理器1110执行计算机程序时,计算机设备实现本申请实施例提供的前述模型保护方法。The embodiments of the present application provide a computer device. As shown in FIG. 11 , the computer device 1100 includes a processor 1110 , a communication interface 1120 and a memory 1130 . The processor 1110 , the communication interface 1120 and the memory 1130 are connected to each other through a bus 1140 . A computer program is stored in the memory 1130 . When the processor 1110 executes the computer program, the computer device implements the foregoing model protection method provided by the embodiments of the present application.
该总线1140可以分为地址总线、数据总线、控制总线等。为便于表示,图11中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The bus 1140 can be divided into an address bus, a data bus, a control bus, and the like. For ease of presentation, only one thick line is used in FIG. 11, but it does not mean that there is only one bus or one type of bus.
存储器1130可以包括易失性存储器(volatile memory),例如随机存取存储器(random-access memory,RAM)。存储器1130也可以包括非易失性存储器(non-volatile memory),例如快闪存储器(flash memory),硬盘(hard disk drive,HDD)或固态硬盘(solid-state drive,SSD)。存储器1130还可以包括上述种类的存储器的组合。The memory 1130 may include volatile memory, such as random-access memory (RAM). The memory 1130 may also include non-volatile memory (non-volatile memory) such as flash memory (flash memory), hard disk drive (HDD) or solid-state drive (SSD). Memory 1130 may also include a combination of the above-described types of memory.
处理器1110可以是硬件芯片,用于完成本申请实施例提供的模型保护方法。该硬件芯片可以是专用集成电路(application-specific integrated circuit,ASIC),可编程逻辑器件(programmable logic device,PLD)或其组合。上述PLD可以是复杂可编程逻辑器件(complex programmable logic device,CPLD),现场可编程逻辑门阵列(field-programmable gate array,FPGA),通用阵列逻辑(generic array logic,GAL)或其任意组合。或者,处理器1110也可以是通用处理器,例如,中央处理器(central processing unit,CPU),网络处理器(network processor,NP)或者CPU和NP的组合。The processor 1110 may be a hardware chip, and is configured to implement the model protection method provided by the embodiments of the present application. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD) or a combination thereof. The above-mentioned PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a general-purpose array logic (generic array logic, GAL) or any combination thereof. Alternatively, the processor 1110 may also be a general-purpose processor, such as a central processing unit (CPU), a network processor (NP), or a combination of CPU and NP.
相应地,存储器1130用于存储程序指令,处理器1110调用该存储器1130中存储的程序指令,可以执行本申请实施例提供的模型保护方法中的一个或多个步骤,或其中可选的实施方式,使得计算机设备1100实现上述方法实施例提供的模型保护方法。例如,处理器1110调用该存储器1120中存储的程序指令,计算机设备1100可以执行访问权限控制器执行的以下步骤:获取读指令中包含的用于读取AI模型的读地址,基于读地址对读指令执行鉴权操作, 基于鉴权结果生成控制信号,将读指令发送至内存控制器。并且,计算机设备1100通过执行存储器1120中的计算机指令,执行该步骤的实现过程可以相应参考前述实施例中对应的描述。Correspondingly, the memory 1130 is used to store program instructions, and the processor 1110 invokes the program instructions stored in the memory 1130 to execute one or more steps in the model protection method provided by the embodiments of the present application, or optional implementations therein. , so that the computer device 1100 implements the model protection method provided by the above method embodiments. For example, the processor 1110 invokes the program instructions stored in the memory 1120, and the computer device 1100 can perform the following steps performed by the access authority controller: acquiring the read address for reading the AI model contained in the read instruction, and performing the read address based on the read address. The instruction performs an authentication operation, generates a control signal based on the authentication result, and sends the read instruction to the memory controller. Moreover, by executing the computer instructions in the memory 1120 by the computer device 1100, the implementation process of executing this step may refer to the corresponding description in the foregoing embodiments.
通信接口1130可以是以下器件的任一种或任一种组合:网络接口(如以太网接口)、无线网卡等具有网络接入功能的器件。The communication interface 1130 may be any one or any combination of the following devices: a network interface (eg, an Ethernet interface), a wireless network card, and other devices with a network access function.
本申请实施例提供了一种计算机可读存储介质,该存储介质可以为非瞬态的可读存储介质,该计算机可读存储介质中存储有指令,当该指令被处理器执行时,该计算机用于执行本申请实施例提供的前述模型保护方法。该存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。该可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如SSD)。An embodiment of the present application provides a computer-readable storage medium, which may be a non-transitory readable storage medium, and stores instructions in the computer-readable storage medium. When the instructions are executed by a processor, the computer It is used to execute the foregoing model protection method provided by the embodiments of the present application. The storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, a data center, etc. that includes one or more available mediums integrated. The available media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVDs), or semiconductor media (eg, SSDs).
本申请还提供了一种计算机程序产品,该计算机程序产品包括计算机指令,在被计算机设备执行时,该计算机设备执行本申请实施例提供的前述模型保护方法。The present application also provides a computer program product, where the computer program product includes computer instructions, and when executed by a computer device, the computer device executes the aforementioned model protection method provided by the embodiments of the present application.
本申请实施例还提供了另一种模型保护装置,该模型保护装置能够对读取AI模型的操作进行鉴权,并根据鉴权结果确定是否从内存中读取AI模型,以通过对AI模型的读取过程进行控制,防止AI的泄露和滥用,实现对AI模型的保护。The embodiment of the present application also provides another model protection device, the model protection device can authenticate the operation of reading the AI model, and determine whether to read the AI model from the memory according to the authentication result, so as to pass the AI model It can control the reading process of AI, prevent the leakage and abuse of AI, and realize the protection of AI model.
该模型保护装置可以部署在计算装置中。本申请实施例提供了一种计算装置。该计算装置可以为摄像头、台式电脑、移动电话、平板电脑、智能电视、智能可穿戴设备、车载通信设备和计算机等。该计算装置的结构示意图请参考图2。如图2所示,该计算装置0包括:驱动模块10、内存20和模型保护装置30,且该模型保护装置30包括内存控制器301、访问权限控制器302和专用处理器303。其中,该计算装置0中驱动模块10、内存20和专用处理器303的工作过程请相应前面实施例中计算装置0中对应器件的工作过程,此处不再赘述。The model protector may be deployed in a computing device. Embodiments of the present application provide a computing device. The computing device may be a camera, a desktop computer, a mobile phone, a tablet computer, a smart TV, a smart wearable device, an in-vehicle communication device, a computer, and the like. Please refer to FIG. 2 for a schematic structural diagram of the computing device. As shown in FIG. 2 , the computing device 0 includes a driver module 10 , a memory 20 and a model protection device 30 , and the model protection device 30 includes a memory controller 301 , an access authority controller 302 and a dedicated processor 303 . The working process of the driving module 10 , the memory 20 and the dedicated processor 303 in the computing device 0 corresponds to the working process of the corresponding device in the computing device 0 in the previous embodiment, and will not be repeated here.
下面对本申请实施例提供的模型保护装置30的实现方式进行说明。在一种可实现方式中,如图3所示,模型保护装置30包括:访问权限控制器302和内存控制器301。访问权限控制器302用于获取读指令,对读指令执行鉴权操作,基于鉴权结果生成读指示信号,并将该读指示信号和读指令发送至内存控制器301。该读指示信号用于指示是否允许从内存20中读取AI模型。内存控制器301用于在读指示信号的指示下,基于读指令从内存20中读取AI模型,或者,在读指示信号的指示下,不执行基于读指令从内存20中读取AI模型的操作。The implementation manner of the model protection device 30 provided by the embodiments of the present application will be described below. In an implementation manner, as shown in FIG. 3 , the model protection device 30 includes: an access authority controller 302 and a memory controller 301 . The access authority controller 302 is configured to acquire a read instruction, perform an authentication operation on the read instruction, generate a read instruction signal based on the authentication result, and send the read instruction signal and the read instruction to the memory controller 301 . The read indication signal is used to indicate whether the AI model is allowed to be read from the memory 20 . The memory controller 301 is configured to read the AI model from the memory 20 based on the read instruction under the instruction of the read instruction signal, or not perform the operation of reading the AI model from the memory 20 based on the read instruction under the instruction of the read instruction signal.
其中,读指示信号包括第一读指示信号和第二读指示信号。第一读指示信号用于指示允许从内存20中读出AI模型。第二读指示信号用于指示不允许从内存20中读出AI模型。相应的,访问权限控制器302用于在对读指令的鉴权通过时,生成第一读指示信号,在对读指令的鉴权不通过时,生成第二读指示信号。The read indication signal includes a first read indication signal and a second read indication signal. The first read indication signal is used to indicate that the AI model is allowed to be read from the memory 20 . The second read indication signal is used to indicate that the AI model is not allowed to be read from the memory 20 . Correspondingly, the access authority controller 302 is configured to generate a first read instruction signal when the authentication of the read instruction is passed, and generate a second read instruction signal when the authentication of the read instruction fails.
可选地,该读指示信号还用于指示是否对从内存20中读取的AI模型进行解密。此时,访问权限控制器302还用于将该读指示信号发送至模型保护装置30的解密电路304,以便于解密电路304在该读指示信号的指示下执行对应的操作。相应的,第一读指示信号用于指示允许从内存20中读出AI模型,且允许对从内存20中读取的AI模型进行解密。第二读指示信号用于指示不允许从内存20中读出AI模型,且不允许对从内存20中读取的AI模型进行 解密。Optionally, the read indication signal is also used to indicate whether to decrypt the AI model read from the memory 20 . At this time, the access authority controller 302 is further configured to send the read instruction signal to the decryption circuit 304 of the model protection device 30, so that the decryption circuit 304 can perform corresponding operations under the instruction of the read instruction signal. Correspondingly, the first read indication signal is used to indicate that the AI model is allowed to be read from the memory 20 and the AI model read from the memory 20 is allowed to be decrypted. The second read instruction signal is used to indicate that the AI model is not allowed to be read from the memory 20, and the AI model read from the memory 20 is not allowed to be decrypted.
在另一种可实现方式中,如图3所示,模型保护装置30包括:访问权限控制器302和内存控制器301。访问权限控制器302用于获取读指令,对读指令执行鉴权操作,基于鉴权结果确定是否向内存控制器301发送读指令。可选地,访问权限控制器302用于在对读指令的鉴权通过时,将读指令发送至内存控制器301,以便于内存控制器301基于该读指令从内存20中读出AI模型;在对读指令的鉴权不通过时,对读指令进行拦截,使得内存控制器301无法接收到该读指令,从而无法从内存20中读取该读指令请求读取的AI模型。In another implementation manner, as shown in FIG. 3 , the model protection device 30 includes: an access authority controller 302 and a memory controller 301 . The access authority controller 302 is configured to acquire the read command, perform an authentication operation on the read command, and determine whether to send the read command to the memory controller 301 based on the authentication result. Optionally, the access authority controller 302 is configured to send the read command to the memory controller 301 when the authentication of the read command is passed, so that the memory controller 301 can read the AI model from the memory 20 based on the read command; When the authentication of the read command fails, the read command is intercepted, so that the memory controller 301 cannot receive the read command, so that the AI model requested by the read command cannot be read from the memory 20 .
可选地,访问权限控制器302具体用于:获取读指令中包含的用于读取AI模型的读地址,基于读地址对读指令执行鉴权操作。Optionally, the access authority controller 302 is specifically configured to: acquire a read address for reading the AI model included in the read instruction, and perform an authentication operation on the read instruction based on the read address.
在访问权限控制器302鉴权的一种可实现方式中,访问权限控制器302具体用于:当读地址为合法地址时,确定对读指令的鉴权通过,当读地址为非法地址时,确定对读指令的鉴权不通过。In an implementation manner of the authentication of the access authority controller 302, the access authority controller 302 is specifically configured to: when the read address is a legal address, determine that the authentication of the read instruction has passed, and when the read address is an illegal address, It is determined that the authentication of the read command fails.
在访问权限控制器302鉴权的另一种可实现方式中,模型保护装置30中存储有解密权限标识,解密权限标识用于指示当前计算任务使用的AI模型是否允许被解密,访问权限控制器302具体用于:当读地址为合法地址且满足指定条件时,确定对读指令的鉴权通过;当读地址为非法地址,和/或,不满足指定条件时,确定对读指令的鉴权不通过。其中,指定条件包括以下至少一个:解密权限标识指示当前计算任务使用的AI模型允许被解密,或,AI模型为加密模型。In another possible implementation of authentication by the access authority controller 302, the model protection device 30 stores a decryption authority identifier, and the decryption authority identifier is used to indicate whether the AI model used by the current computing task is allowed to be decrypted, and the access authority controller 302 is specifically used for: when the read address is a legal address and the specified condition is met, determine that the authentication of the read instruction is passed; when the read address is an illegal address, and/or, when the specified condition is not met, determine the authentication of the read instruction Fail. The specified condition includes at least one of the following: the decryption permission identifier indicates that the AI model used by the current computing task is allowed to be decrypted, or the AI model is an encryption model.
可选地,访问权限控制器302还用于:当读地址为非法地址时,控制解密权限标识指示当前计算任务使用的所有AI模型均不允许被解密。Optionally, the access authority controller 302 is further configured to: when the read address is an illegal address, control the decryption authority identifier to indicate that all AI models used by the current computing task are not allowed to be decrypted.
可选地,访问权限控制器302还用于:在完成当前计算任务后,将解密权限标识重置为指示允许解密。Optionally, the access authority controller 302 is further configured to reset the decryption authority identifier to indicate that decryption is permitted after the current computing task is completed.
可选地,如图4所示,模型保护装置30还包括:第一寄存器305,第一寄存器305用于存储AI模型在内存20中的有效地址范围;相应的,访问权限控制器302具体用于从第一寄存器305中读取有效地址范围,基于有效地址范围和读地址对读指令执行鉴权操作。Optionally, as shown in FIG. 4 , the model protection device 30 further includes: a first register 305, where the first register 305 is used to store the effective address range of the AI model in the memory 20; correspondingly, the access authority controller 302 specifically uses In order to read the effective address range from the first register 305, an authentication operation is performed on the read command based on the effective address range and the read address.
并且,如图4所示,模型保护装置30还包括:解密电路304和专用处理器303。专用处理器303用于生成读指令,并将读指令发送至访问权限控制器302。解密电路304用于对AI模型进行解密,并将解密后地AI模型传输给专用处理器303,或者,向专用处理器303透传AI模型。专用处理器303还用于基于解密电路304传输的AI模型,执行当前计算任务。Moreover, as shown in FIG. 4 , the model protection device 30 further includes: a decryption circuit 304 and a dedicated processor 303 . The dedicated processor 303 is used to generate a read command and send the read command to the access rights controller 302 . The decryption circuit 304 is used to decrypt the AI model, and transmit the decrypted AI model to the special-purpose processor 303 , or transparently transmit the AI model to the special-purpose processor 303 . The dedicated processor 303 is also used for executing the current computing task based on the AI model transmitted by the decryption circuit 304 .
进一步地,如图4所示,模型保护装置30还包括:密钥生成电路306;密钥生成电路306用于获取模型保护装置30的根密钥、AI模型的版本标识和模型保护装置30的装置标识,基于根密钥、版本标识和装置标识,生成用于对AI模型进行解密的解密密钥。Further, as shown in FIG. 4 , the model protection device 30 further includes: a key generation circuit 306 ; the key generation circuit 306 is used to obtain the root key of the model protection device 30 , the version identifier of the AI model and the Device ID, based on the root key, version ID, and device ID, to generate a decryption key for decrypting the AI model.
并且,如图4所示,模型保护装置30还包括:第二寄存器307。第二寄存器307用于存储解密密钥。相应的,模型保护装置30中的解密电路304具体用于从第二寄存器307中读取解密密钥,采用解密密钥对AI模型解密。Moreover, as shown in FIG. 4 , the model protection device 30 further includes: a second register 307 . The second register 307 is used to store the decryption key. Correspondingly, the decryption circuit 304 in the model protection device 30 is specifically configured to read the decryption key from the second register 307, and use the decryption key to decrypt the AI model.
综上所述,在本申请实施例提供的模型保护装置中,通过访问权限控制器对读指令进行鉴权,并根据鉴权结果控制是否根据读指令从内存中读取读指令请求读取的AI模型,当该AI模型以加密模型的形式存储在内存中时,若鉴权通过才能够从内存中读取AI模型,才有可能成功使用该AI模型,若鉴权不通过无法从内存中读取AI模型,则无法使用该AI模型。 因此,通过对从内存中读取AI模型的过程进行控制,能够防止AI的拷贝、泄露和滥用,实现对该AI模型的保护,有助于建立完善的AI模型生态,构筑安全合理的盈利模式。并且,本申请实施例提供的一种模型保护装置能够在单个SOC上实现,不需要耗费额外的SOC成本以及不同SOC芯片之间进行交互的成本,能够使用较低的成本实现对AI模型的安全保护。同时,通过对读指令进行鉴权实现对AI模型的保护,还提供了一种对指令做合法性检查的技术,能够将本申请实施例通过对指令做合法性检查的技术应用在类似的需要做权限检查的场景中。To sum up, in the model protection device provided in the embodiment of the present application, the read command is authenticated by the access authority controller, and according to the authentication result, it is controlled whether to read the read command from the memory according to the read command. AI model, when the AI model is stored in the memory in the form of an encrypted model, if the authentication is passed, the AI model can be read from the memory, and it is possible to use the AI model successfully. Read the AI model, the AI model cannot be used. Therefore, by controlling the process of reading the AI model from the memory, it can prevent the copying, leakage and abuse of AI, realize the protection of the AI model, help to establish a perfect AI model ecology, and build a safe and reasonable profit model . In addition, a model protection device provided by the embodiment of the present application can be implemented on a single SOC, does not require additional SOC cost and the cost of interaction between different SOC chips, and can realize the security of the AI model at a lower cost. Protect. At the same time, the protection of the AI model is realized by authenticating the read command, and a technology for checking the validity of the command is also provided, so that the embodiment of the present application can be applied to similar needs through the technology of checking the validity of the command. In scenarios where permission checks are performed.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的模型保护装置中各个器件的实现方式和具体工作过程,可以相应参考本申请实施例提供的前述模型保护装置中的对应内容,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and conciseness of the description, the implementation manner and specific working process of each device in the model protection device described above may refer to the model protection device provided in the embodiment of the present application. The corresponding content is not repeated here.
本申请实施例提供了一种模型保护方法。该模型保护方法应用于模型保护装置,该模型保护装置包括:访问权限控制器和内存控制器。例如,该模型保护方法可以应用于本申请实施例提供的前述模型保护装置。The embodiment of the present application provides a model protection method. The model protection method is applied to a model protection device, and the model protection device includes an access authority controller and a memory controller. For example, the model protection method can be applied to the aforementioned model protection device provided in the embodiments of the present application.
在该模型保护方法中,访问权限控制器可以获取读指令,对所述读指令执行鉴权操作,并基于鉴权结果控制内存控制器是否从内存中读出AI模型。这样一来,访问权限控制器能够通过对从内存中读取AI模型的过程进行控制,防止AI的泄露和滥用,实现对AI模型的保护。In the model protection method, the access authority controller can obtain a read instruction, perform an authentication operation on the read instruction, and control whether the memory controller reads the AI model from the memory based on the authentication result. In this way, the access authority controller can control the process of reading the AI model from the memory, prevent the leakage and abuse of the AI, and realize the protection of the AI model.
下面以该模型保护方法应用于图4所示的模型保护装置为例,对该模型保护方法的第一种实现方式进行说明。如图12所示,该模型保护方法包括:The first implementation manner of the model protection method will be described below by taking the model protection method applied to the model protection device shown in FIG. 4 as an example. As shown in Figure 12, the model protection method includes:
步骤1201、专用处理器生成读指令,并将读指令发送至访问权限控制器。Step 1201: The dedicated processor generates a read instruction, and sends the read instruction to the access authority controller.
步骤1202、访问权限控制器获取读指令中包含的用于读取AI模型的读地址,基于读地址对读指令执行鉴权操作,基于鉴权结果生成读指示信号,并将该读指示信号和读指令发送至内存控制器。 Step 1202, the access authority controller obtains the read address for reading the AI model contained in the read instruction, performs an authentication operation on the read instruction based on the read address, generates a read instruction signal based on the authentication result, and compares the read instruction signal with the read instruction signal. The read command is sent to the memory controller.
其中,读指示信号包括第一读指示信号和第二读指示信号。第一读指示信号用于指示从内存中读出AI模型。第二读指示信号用于指示不从内存中读出AI模型。相应的,访问权限控制器用于在对读指令的鉴权通过时,生成第一读指示信号,在对读指令的鉴权不通过时,生成第二读指示信号。The read indication signal includes a first read indication signal and a second read indication signal. The first read indication signal is used to instruct the AI model to be read from the memory. The second read indication signal is used to instruct not to read the AI model from the memory. Correspondingly, the access authority controller is configured to generate a first read instruction signal when the authentication of the read instruction is passed, and generate a second read instruction signal when the authentication of the read instruction fails.
在一种可实现方式中,访问权限控制器对所述读指令执行鉴权操作,包括:当读地址为合法地址时,确定对读指令的鉴权通过,当读地址为非法地址时,确定对读指令的鉴权不通过。In an achievable manner, the access authority controller performs an authentication operation on the read instruction, including: when the read address is a legal address, determining that the authentication of the read instruction is passed, and when the read address is an illegal address, determining The authentication of the read command failed.
在另一种可实现方式中,访问权限控制器对所述读指令执行鉴权操作,包括:当读地址为合法地址且满足指定条件时,确定对读指令的鉴权通过;当读地址为非法地址,和/或,不满足指定条件时,确定对读指令的鉴权不通过。其中,指定条件包括以下至少一个:解密权限标识指示当前计算任务使用的AI模型允许被解密,或,AI模型为加密模型。In another implementation manner, the access authority controller performs an authentication operation on the read instruction, including: when the read address is a legal address and meets a specified condition, determining that the authentication of the read instruction is passed; when the read address is If the address is illegal, and/or the specified condition is not met, it is determined that the authentication of the read command fails. The specified condition includes at least one of the following: the decryption permission identifier indicates that the AI model used by the current computing task is allowed to be decrypted, or the AI model is an encryption model.
步骤1203、内存控制器在读指示信号的指示下,基于读指令从内存中读取AI模型,并向解密电路提供AI模型,或者,在读指示信号的指示下,不执行基于读指令从内存中读取AI模型的操作。Step 1203: Under the instruction of the read instruction signal, the memory controller reads the AI model from the memory based on the read instruction, and provides the AI model to the decryption circuit, or, under the instruction of the read instruction signal, does not execute the read instruction from the memory based on the read instruction. Take the operation of the AI model.
步骤1204、解密电路对AI模型进行解密,并将解密后地AI模型传输给专用处理器,或 者,向专用处理器透传AI模型。Step 1204: The decryption circuit decrypts the AI model, and transmits the decrypted AI model to the dedicated processor, or transparently transmits the AI model to the dedicated processor.
步骤1205、专用处理器基于解密电路传输的AI模型,执行当前计算任务。Step 1205: The dedicated processor executes the current computing task based on the AI model transmitted by the decryption circuit.
下面以该模型保护方法应用于图4所示的模型保护装置为例,对该模型保护方法的第二种实现方式进行说明。如图13所示,该模型保护方法包括:The second implementation manner of the model protection method is described below by taking the model protection method applied to the model protection device shown in FIG. 4 as an example. As shown in Figure 13, the model protection method includes:
步骤1301、专用处理器生成读指令,并将读指令发送至访问权限控制器。Step 1301: The dedicated processor generates a read instruction, and sends the read instruction to the access authority controller.
步骤1302、访问权限控制器获取读指令中包含的用于读取AI模型的读地址,基于读地址对读指令执行鉴权操作,基于鉴权结果确定是否向内存控制器发送读指令。Step 1302: The access authority controller obtains the read address for reading the AI model included in the read instruction, performs an authentication operation on the read instruction based on the read address, and determines whether to send the read instruction to the memory controller based on the authentication result.
其中,访问权限控制器在对读指令的鉴权通过时,将读指令发送至内存控制器,然后执行步骤1303,以便于内存控制器基于该读指令从内存中读出AI模型;在对读指令的鉴权不通过时,对读指令进行拦截,使得内存控制器无法接收到该读指令,从而无法从内存中读取该读指令请求读取的AI模型,结束本次根据读指令进行模型保护的过程。The access authority controller sends the read instruction to the memory controller when the authentication of the read instruction passes, and then executes step 1303, so that the memory controller can read the AI model from the memory based on the read instruction; When the authentication of the instruction fails, the read instruction is intercepted, so that the memory controller cannot receive the read instruction, so that the AI model requested by the read instruction cannot be read from the memory, and the model based on the read instruction ends this time. process of protection.
步骤1303、内存控制器基于读指令从内存中读取AI模型,并向解密电路提供AI模型。Step 1303: The memory controller reads the AI model from the memory based on the read instruction, and provides the AI model to the decryption circuit.
步骤1304、解密电路对AI模型进行解密,并将解密后地AI模型传输给专用处理器,或者,向专用处理器透传AI模型。Step 1304: The decryption circuit decrypts the AI model, and transmits the decrypted AI model to the dedicated processor, or transparently transmits the AI model to the dedicated processor.
步骤1305、专用处理器基于解密电路传输的AI模型,执行当前计算任务。Step 1305: The dedicated processor executes the current computing task based on the AI model transmitted by the decryption circuit.
需要说明的是,本申请实施例提供的模型保护方法步骤的先后顺序可以进行适当调整,步骤也可以根据情况进行相应增减,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化的方法,都应涵盖在本申请的保护范围之内,因此不再赘述。It should be noted that the sequence of steps of the model protection method provided by the embodiments of the present application can be appropriately adjusted, and the steps can also be correspondingly increased or decreased according to the situation. Any person skilled in the art is within the technical scope disclosed in this application, Changes in methods that can be easily thought of should be covered within the scope of protection of the present application, and thus will not be repeated here.
综上所述,在本申请实施例提供的模型保护方法中,通过访问权限控制器对读指令进行鉴权,并根据鉴权结果控制是否根据读指令从内存中读取读指令请求读取的AI模型,当该AI模型以加密模型的形式存储在内存中时,若鉴权通过才能够从内存中读取AI模型,才有可能成功使用该AI模型,若鉴权不通过无法从内存中读取AI模型,则无法使用该AI模型。因此,通过对从内存中读取AI模型的过程进行控制,能够防止AI的拷贝、泄露和滥用,实现对该AI模型的保护,有助于建立完善的AI模型生态,构筑安全合理的盈利模式。并且,本申请实施例提供的一种模型保护装置能够在单个SOC上实现,不需要耗费额外的SOC成本以及不同SOC芯片之间进行交互的成本,能够使用较低的成本实现对AI模型的安全保护。同时,通过对读指令进行鉴权实现对AI模型的保护,还提供了一种对指令做合法性检查的技术,能够将本申请实施例通过对指令做合法性检查的技术应用在类似的需要做权限检查的场景中。To sum up, in the model protection method provided by the embodiment of the present application, the read instruction is authenticated by the access authority controller, and according to the authentication result, it is controlled whether to read the request to read the read instruction from the memory according to the read instruction. AI model, when the AI model is stored in the memory in the form of an encrypted model, if the authentication is passed, the AI model can be read from the memory, and it is possible to use the AI model successfully. Read the AI model, the AI model cannot be used. Therefore, by controlling the process of reading the AI model from the memory, it can prevent the copying, leakage and abuse of AI, realize the protection of the AI model, help to establish a perfect AI model ecology, and build a safe and reasonable profit model . In addition, a model protection device provided by the embodiment of the present application can be implemented on a single SOC, does not require additional SOC cost and the cost of interaction between different SOC chips, and can realize the security of the AI model at a lower cost. Protect. At the same time, the protection of the AI model is realized by authenticating the read command, and a technology for checking the validity of the command is also provided, so that the embodiment of the present application can be applied to similar needs through the technology of checking the validity of the command. In scenarios where permission checks are performed.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的模型保护方法中各个器件的实现方式和具体工作过程,可以相应参考本申请实施例提供的模型保护装置中的对应内容,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and conciseness of the description, the implementation manner and specific working process of each device in the model protection method described above may refer to the corresponding correspondence in the model protection device provided in the embodiment of the present application. The content will not be repeated here.
本申请实施例提供了一种计算机设备。该计算机设备包括处理器,通信接口和存储器。该处理器,通信接口和存储器之间通过总线相互连接。存储器中存储有计算机程序。处理器执行计算机程序时,计算机设备实现本申请实施例提供的前述模型保护方法。该计算机设备的实现方式和结构请参考本申请实施例提供的前述计算机设备的相应内容。The embodiments of the present application provide a computer device. The computer device includes a processor, a communication interface and a memory. The processor, the communication interface and the memory are connected to each other through a bus. A computer program is stored in the memory. When the processor executes the computer program, the computer device implements the foregoing model protection method provided by the embodiments of the present application. For the implementation manner and structure of the computer device, please refer to the corresponding content of the aforementioned computer device provided in the embodiments of the present application.
本申请实施例提供了一种计算机可读存储介质,该存储介质可以为非瞬态的可读存储介 质,该计算机可读存储介质中存储有指令,当该指令被处理器执行时,该计算机用于执行本申请实施例提供的前述模型保护方法。该存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。该可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如SSD)。An embodiment of the present application provides a computer-readable storage medium, which may be a non-transitory readable storage medium, and stores instructions in the computer-readable storage medium. When the instructions are executed by a processor, the computer It is used to execute the foregoing model protection method provided by the embodiments of the present application. The storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, a data center, etc. that includes one or more available mediums integrated. The available media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVDs), or semiconductor media (eg, SSDs).
本申请还提供了一种计算机程序产品,该计算机程序产品包括计算机指令,在被计算机设备执行时,该计算机设备执行本申请实施例提供的前述模型保护方法。The present application also provides a computer program product, where the computer program product includes computer instructions, and when executed by a computer device, the computer device executes the aforementioned model protection method provided by the embodiments of the present application.
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。Those of ordinary skill in the art can understand that all or part of the steps of implementing the above embodiments can be completed by hardware, or can be completed by instructing relevant hardware through a program, and the program can be stored in a computer-readable storage medium. The storage medium mentioned may be a read-only memory, a magnetic disk or an optical disk, etc.
以上所述仅为本申请的可选实施例,并不用以限制本申请,凡在本申请的原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。The above are only optional embodiments of the present application, and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the principles of the present application shall be included in the protection scope of the present application. Inside.

Claims (21)

  1. 一种模型保护装置,其特征在于,所述模型保护装置包括:访问权限控制器和内存控制器;A model protection device, characterized in that the model protection device comprises: an access authority controller and a memory controller;
    所述访问权限控制器用于获取读指令,所述读指令用于请求从内存中读取人工智能AI模型;The access authority controller is used to obtain a read instruction, and the read instruction is used to request to read the artificial intelligence AI model from the memory;
    所述访问权限控制器还用于对所述读指令执行鉴权操作,并基于鉴权结果生成控制信号,所述控制信号用于指示是否对从所述内存中读取的所述AI模型进行解密;The access authority controller is further configured to perform an authentication operation on the read instruction, and generate a control signal based on the authentication result, where the control signal is used to indicate whether to perform an authentication operation on the AI model read from the memory. decrypt;
    所述访问权限控制器还用于将所述读指令发送至所述内存控制器;The access authority controller is further configured to send the read instruction to the memory controller;
    所述内存控制器用于基于所述读指令从所述内存中读取所述AI模型。The memory controller is configured to read the AI model from the memory based on the read instruction.
  2. 根据权利要求1所述的模型保护装置,其特征在于,所述访问权限控制器具体用于:The model protection device according to claim 1, wherein the access authority controller is specifically used for:
    获取所述读指令中包含的用于读取所述AI模型的读地址,基于所述读地址对所述读指令执行鉴权操作。Acquire a read address for reading the AI model included in the read instruction, and perform an authentication operation on the read instruction based on the read address.
  3. 根据权利要求2所述的模型保护装置,其特征在于,所述控制信号包括第一控制信号和第二控制信号,所述第一控制信号用于指示对所述AI模型进行解密,所述第二控制信号用于指示不对所述AI模型进行解密,所述访问权限控制器具体用于:The model protection device according to claim 2, wherein the control signal comprises a first control signal and a second control signal, the first control signal is used to instruct the AI model to be decrypted, and the first control signal is used for decrypting the AI model. The second control signal is used to indicate that the AI model is not to be decrypted, and the access authority controller is specifically used for:
    当所述读地址为合法地址时,生成所述第一控制信号;When the read address is a legal address, generating the first control signal;
    当所述读地址为非法地址时,生成所述第二控制信号。When the read address is an illegal address, the second control signal is generated.
  4. 根据权利要求2所述的模型保护装置,其特征在于,所述控制信号包括第一控制信号和第二控制信号,所述第一控制信号用于指示对所述AI模型进行解密,所述第二控制信号用于指示不对所述AI模型进行解密,所述模型保护装置中存储有解密权限标识,所述解密权限标识用于指示当前计算任务使用的AI模型是否允许被解密,所述访问权限控制器具体用于:The model protection device according to claim 2, wherein the control signal comprises a first control signal and a second control signal, the first control signal is used to instruct the AI model to be decrypted, and the first control signal is used for decrypting the AI model. The second control signal is used to indicate that the AI model is not to be decrypted, the model protection device stores a decryption authority identifier, the decryption authority identifier is used to indicate whether the AI model used by the current computing task is allowed to be decrypted, and the access authority The controller is specifically used for:
    当所述读地址为合法地址且满足指定条件时,生成所述第一控制信号;When the read address is a legal address and meets a specified condition, generating the first control signal;
    当所述读地址为非法地址,和/或,不满足所述指定条件时,生成所述第二控制信号;When the read address is an illegal address, and/or the specified condition is not met, generating the second control signal;
    其中,所述指定条件包括以下至少一个:Wherein, the specified condition includes at least one of the following:
    所述解密权限标识指示所述当前计算任务使用的AI模型允许被解密;The decryption authority identifier indicates that the AI model used by the current computing task is allowed to be decrypted;
    或,所述AI模型为加密模型。Or, the AI model is an encryption model.
  5. 根据权利要求4所述的模型保护装置,其特征在于,所述访问权限控制器还用于:The model protection device according to claim 4, wherein the access authority controller is further used for:
    当所述读地址为非法地址时,控制所述解密权限标识指示所述当前计算任务使用的所有AI模型均不允许被解密。When the read address is an illegal address, controlling the decryption permission identifier indicates that all AI models used by the current computing task are not allowed to be decrypted.
  6. 根据权利要求4或5所述的模型保护装置,其特征在于,所述访问权限控制器还用于:The model protection device according to claim 4 or 5, wherein the access authority controller is further used for:
    在完成所述当前计算任务后,将所述解密权限标识重置为指示允许解密。After the current computing task is completed, the decryption authority identifier is reset to indicate that decryption is permitted.
  7. 根据权利要求2至6任一所述的模型保护装置,其特征在于,所述模型保护装置还包括:第一寄存器,所述第一寄存器用于存储所述AI模型在内存中的有效地址范围;The model protection device according to any one of claims 2 to 6, wherein the model protection device further comprises: a first register, where the first register is used to store an effective address range of the AI model in a memory ;
    所述访问权限控制器具体用于从所述第一寄存器中读取所述有效地址范围,基于所述有效地址范围和所述读地址对所述读指令执行鉴权操作。The access authority controller is specifically configured to read the effective address range from the first register, and perform an authentication operation on the read instruction based on the effective address range and the read address.
  8. 根据权利要求1至7任一所述的模型保护装置,其特征在于,所述模型保护装置还包括:解密电路和专用处理器;The model protection device according to any one of claims 1 to 7, wherein the model protection device further comprises: a decryption circuit and a dedicated processor;
    所述专用处理器用于生成所述读指令,并将所述读指令发送至所述访问权限控制器;The dedicated processor is configured to generate the read instruction and send the read instruction to the access rights controller;
    所述解密电路用于接收所述访问权限控制器生成的控制信号,并在所述控制信号的指示下,对所述AI模型进行解密后传输给所述专用处理器,或者,在所述控制信号的指示下,向所述专用处理器透传所述AI模型;The decryption circuit is configured to receive the control signal generated by the access authority controller, and under the instruction of the control signal, decrypt the AI model and transmit it to the special-purpose processor, or, in the control Under the instruction of the signal, transparently transmit the AI model to the dedicated processor;
    所述专用处理器还用于基于所述解密电路传输的AI模型,执行所述当前计算任务。The dedicated processor is further configured to execute the current computing task based on the AI model transmitted by the decryption circuit.
  9. 根据权利要求1至8任一项所述的模型保护装置,其特征在于,所述模型保护装置还包括:密钥生成电路;The model protection device according to any one of claims 1 to 8, wherein the model protection device further comprises: a key generation circuit;
    所述密钥生成电路用于获取所述模型保护装置的根密钥、所述AI模型的版本标识和所述模型保护装置的装置标识,基于所述根密钥、所述版本标识和所述装置标识,生成用于对所述AI模型进行解密的解密密钥。The key generation circuit is used to obtain the root key of the model protection device, the version identification of the AI model and the device identification of the model protection device, based on the root key, the version identification and the Device identification, generating a decryption key for decrypting the AI model.
  10. 根据权利要求9所述的模型保护装置,其特征在于,所述模型保护装置还包括:第二寄存器;The model protection device according to claim 9, wherein the model protection device further comprises: a second register;
    所述第二寄存器用于存储所述解密密钥;the second register is used to store the decryption key;
    所述模型保护装置中的解密电路具体用于从所述第二寄存器中读取所述解密密钥,在所述控制信号的指示下,采用所述解密密钥对所述AI模型解密。The decryption circuit in the model protection device is specifically configured to read the decryption key from the second register, and under the instruction of the control signal, use the decryption key to decrypt the AI model.
  11. 一种计算装置,其特征在于,所述计算装置包括:内存和如权利要求1至10任一项所述的模型保护装置。A computing device, characterized in that, the computing device comprises: a memory and the model protection device according to any one of claims 1 to 10.
  12. 一种模型保护方法,其特征在于,所述模型保护方法应用于模型保护装置,所述模型保护装置包括:访问权限控制器和内存控制器,所述模型保护方法包括:A model protection method, characterized in that the model protection method is applied to a model protection device, the model protection device includes: an access authority controller and a memory controller, and the model protection method includes:
    所述访问权限控制器获取读指令,所述读指令用于请求从内存中读取人工智能AI模型;The access authority controller obtains a read instruction, and the read instruction is used to request to read the artificial intelligence AI model from the memory;
    所述访问权限控制器对所述读指令执行鉴权操作,并基于鉴权结果生成控制信号,所述控制信号用于指示是否对从所述内存中读取的所述AI模型进行解密;The access authority controller performs an authentication operation on the read instruction, and generates a control signal based on the authentication result, where the control signal is used to indicate whether to decrypt the AI model read from the memory;
    所述访问权限控制器将所述读指令发送至所述内存控制器;the access authority controller sends the read instruction to the memory controller;
    所述内存控制器基于所述读指令从所述内存中读取所述AI模型。The memory controller reads the AI model from the memory based on the read instruction.
  13. 根据权利要求12所述的模型保护方法,其特征在于,所述访问权限控制器对所述读指令执行鉴权操作,包括:The model protection method according to claim 12, wherein the access authority controller performs an authentication operation on the read instruction, comprising:
    所述访问权限控制器获取所述读指令中包含的用于读取所述AI模型的读地址,基于所述读地址对所述读指令执行鉴权操作。The access authority controller acquires a read address for reading the AI model included in the read instruction, and performs an authentication operation on the read instruction based on the read address.
  14. 根据权利要求13所述的模型保护方法,其特征在于,所述控制信号包括第一控制信号和第二控制信号,所述第一控制信号用于指示对所述AI模型进行解密,所述第二控制信号用于指示不对所述AI模型进行解密,所述访问权限控制器基于鉴权结果生成控制信号,包括:The model protection method according to claim 13, wherein the control signal comprises a first control signal and a second control signal, the first control signal is used to instruct to decrypt the AI model, and the first control signal is used to instruct the AI model to be decrypted. The second control signal is used to indicate that the AI model is not to be decrypted, and the access authority controller generates a control signal based on the authentication result, including:
    当所述读地址为合法地址时,所述访问权限控制器生成所述第一控制信号;When the read address is a legal address, the access authority controller generates the first control signal;
    当所述读地址为非法地址时,所述访问权限控制器生成所述第二控制信号。When the read address is an illegal address, the access authority controller generates the second control signal.
  15. 根据权利要求13所述的模型保护方法,其特征在于,所述控制信号包括第一控制信号和第二控制信号,所述第一控制信号用于指示对所述AI模型进行解密,所述第二控制信号用于指示不对所述AI模型进行解密,所述模型保护装置中存储有解密权限标识,所述解密权限标识用于指示当前计算任务使用的AI模型是否允许被解密,所述访问权限控制器基于鉴权结果生成控制信号,包括:The model protection method according to claim 13, wherein the control signal comprises a first control signal and a second control signal, the first control signal is used to instruct to decrypt the AI model, and the first control signal is used to instruct the AI model to be decrypted. The second control signal is used to indicate that the AI model is not to be decrypted, the model protection device stores a decryption authority identifier, the decryption authority identifier is used to indicate whether the AI model used by the current computing task is allowed to be decrypted, and the access authority The controller generates a control signal based on the authentication result, including:
    当所述读地址为合法地址且满足指定条件时,所述访问权限控制器生成所述第一控制信号;When the read address is a legal address and meets a specified condition, the access authority controller generates the first control signal;
    当所述读地址为非法地址,和/或,不满足所述指定条件时,所述访问权限控制器生成所述第二控制信号;When the read address is an illegal address, and/or the specified condition is not met, the access authority controller generates the second control signal;
    其中,所述指定条件包括以下至少一个:Wherein, the specified condition includes at least one of the following:
    所述解密权限标识指示所述当前计算任务使用的AI模型允许被解密;The decryption authority identifier indicates that the AI model used by the current computing task is allowed to be decrypted;
    或,所述AI模型为加密模型。Or, the AI model is an encryption model.
  16. 根据权利要求15所述的模型保护方法,其特征在于,在所述访问权限控制器对所述读指令执行鉴权操作之后,所述模型保护方法还包括:The model protection method according to claim 15, wherein after the access authority controller performs an authentication operation on the read instruction, the model protection method further comprises:
    当所述读地址为非法地址时,所述访问权限控制器控制所述解密权限标识指示所述当前计算任务使用的所有AI模型均不允许被解密。When the read address is an illegal address, the access authority controller controls the decryption authority identifier to indicate that all AI models used by the current computing task are not allowed to be decrypted.
  17. 根据权利要求15或16所述的模型保护方法,其特征在于,在所述访问权限控制器对所述读指令执行鉴权操作之后,所述模型保护方法还包括:The model protection method according to claim 15 or 16, wherein after the access authority controller performs an authentication operation on the read instruction, the model protection method further comprises:
    在完成所述当前计算任务后,所述访问权限控制器将所述解密权限标识重置为指示允许解密。After completing the current computing task, the access authority controller resets the decryption authority identifier to indicate that decryption is permitted.
  18. 根据权利要求13至17任一所述的模型保护方法,其特征在于,所述访问权限控制器对所述读指令执行鉴权操作,包括:The model protection method according to any one of claims 13 to 17, wherein the access authority controller performs an authentication operation on the read instruction, comprising:
    所述访问权限控制器从第一寄存器中读取所述AI模型在内存中的有效地址范围,基于所述有效地址范围和所述读地址对所述读指令执行鉴权操作。The access authority controller reads the effective address range of the AI model in the memory from the first register, and performs an authentication operation on the read instruction based on the effective address range and the read address.
  19. 根据权利要求12至18任一所述的模型保护方法,其特征在于,所述模型保护装置还包括:解密电路和专用处理器,在所述访问权限控制器获取读指令之前,所述模型保护方法还包括:The model protection method according to any one of claims 12 to 18, wherein the model protection device further comprises: a decryption circuit and a dedicated processor, and before the access authority controller acquires a read instruction, the model protection device further comprises: Methods also include:
    所述专用处理器生成所述读指令,并将所述读指令发送至所述访问权限控制器;The dedicated processor generates the read instruction and sends the read instruction to the access rights controller;
    在所述访问权限控制器基于鉴权结果生成控制信号之后,所述模型保护方法还包括:After the access authority controller generates a control signal based on the authentication result, the model protection method further includes:
    所述解密电路接收所述访问权限控制器生成的控制信号,并在所述控制信号的指示下,对所述AI模型进行解密后传输给所述专用处理器,或者,在所述控制信号的指示下,向所述专用处理器透传所述AI模型;The decryption circuit receives the control signal generated by the access authority controller, and under the instruction of the control signal, decrypts the AI model and transmits it to the dedicated processor, or, under the instruction of the control signal, decrypts the AI model and transmits it to the special-purpose processor. Under the instruction, transparently transmit the AI model to the dedicated processor;
    所述专用处理器基于所述解密电路传输的AI模型,执行所述当前计算任务。The dedicated processor executes the current computing task based on the AI model transmitted by the decryption circuit.
  20. 根据权利要求12至19任一项所述的模型保护方法,其特征在于,所述模型保护装置还包括:密钥生成电路,所述模型保护方法还包括:The model protection method according to any one of claims 12 to 19, wherein the model protection device further comprises: a key generation circuit, and the model protection method further comprises:
    所述密钥生成电路获取所述模型保护装置的根密钥、所述AI模型的版本标识和所述模型保护装置的装置标识,基于所述根密钥、所述版本标识和所述装置标识,生成用于对所述AI模型进行解密的解密密钥。The key generation circuit obtains the root key of the model protection device, the version identification of the AI model and the device identification of the model protection device, based on the root key, the version identification and the device identification , and generate a decryption key for decrypting the AI model.
  21. 根据权利要求20所述的模型保护方法,其特征在于,所述模型保护装置还包括:第二寄存器,所述第二寄存器用于存储所述解密密钥,在所述访问权限控制器基于鉴权结果生成控制信号之后,所述模型保护方法还包括:The model protection method according to claim 20, wherein the model protection device further comprises: a second register, the second register is used to store the decryption key, and the access rights controller is based on the authentication After the control signal is generated from the weighted result, the model protection method further includes:
    所述模型保护装置中的解密电路从所述第二寄存器中读取所述解密密钥,在所述控制信号的指示下,采用所述解密密钥对所述AI模型解密。The decryption circuit in the model protection device reads the decryption key from the second register, and under the instruction of the control signal, uses the decryption key to decrypt the AI model.
PCT/CN2020/137748 2020-12-18 2020-12-18 Model protection device, method, and computing device WO2022126644A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2020/137748 WO2022126644A1 (en) 2020-12-18 2020-12-18 Model protection device, method, and computing device
CN202080103291.0A CN115956243A (en) 2020-12-18 2020-12-18 Model protection device and method and computing device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/137748 WO2022126644A1 (en) 2020-12-18 2020-12-18 Model protection device, method, and computing device

Publications (1)

Publication Number Publication Date
WO2022126644A1 true WO2022126644A1 (en) 2022-06-23

Family

ID=82058839

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/137748 WO2022126644A1 (en) 2020-12-18 2020-12-18 Model protection device, method, and computing device

Country Status (2)

Country Link
CN (1) CN115956243A (en)
WO (1) WO2022126644A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115577568A (en) * 2022-11-17 2023-01-06 中国汽车技术研究中心有限公司 Method, device and storage medium for determining operation authority of simulation model
CN116701256A (en) * 2023-06-05 2023-09-05 牛芯半导体(深圳)有限公司 Multi-channel arbiter circuit, interface chip and data access method

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116150740B (en) * 2023-04-17 2023-12-12 杭州鸿钧微电子科技有限公司 Resource isolation method and device, chip system and electronic equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040133797A1 (en) * 2003-01-06 2004-07-08 International Business Machines Corporation Rights management enhanced storage
CN104217175A (en) * 2014-09-05 2014-12-17 北京邮电大学 Data read-write method and device
CN106469124A (en) * 2015-08-20 2017-03-01 深圳市中兴微电子技术有限公司 A kind of memory access control method and device
CN109446835A (en) * 2018-09-30 2019-03-08 龙芯中科技术有限公司 Data access control method, device and equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040133797A1 (en) * 2003-01-06 2004-07-08 International Business Machines Corporation Rights management enhanced storage
CN104217175A (en) * 2014-09-05 2014-12-17 北京邮电大学 Data read-write method and device
CN106469124A (en) * 2015-08-20 2017-03-01 深圳市中兴微电子技术有限公司 A kind of memory access control method and device
CN109446835A (en) * 2018-09-30 2019-03-08 龙芯中科技术有限公司 Data access control method, device and equipment

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115577568A (en) * 2022-11-17 2023-01-06 中国汽车技术研究中心有限公司 Method, device and storage medium for determining operation authority of simulation model
CN115577568B (en) * 2022-11-17 2023-03-28 中国汽车技术研究中心有限公司 Method, device and storage medium for determining operation authority of simulation model
CN116701256A (en) * 2023-06-05 2023-09-05 牛芯半导体(深圳)有限公司 Multi-channel arbiter circuit, interface chip and data access method

Also Published As

Publication number Publication date
CN115956243A (en) 2023-04-11
CN115956243A8 (en) 2024-05-10

Similar Documents

Publication Publication Date Title
US10915633B2 (en) Method and apparatus for device security verification utilizing a virtual trusted computing base
US11720503B2 (en) Technologies for secure authentication and programming of accelerator devices
US11416605B2 (en) Trusted execution environment instances licenses management
US11630904B2 (en) System, apparatus and method for configurable trusted input/output access from authorized software
CN112513857A (en) Personalized cryptographic security access control in a trusted execution environment
WO2022126644A1 (en) Model protection device, method, and computing device
US9191202B2 (en) Information processing device and computer program product
US8572410B1 (en) Virtualized protected storage
US9563774B1 (en) Apparatus and method for securely logging boot-tampering actions
US20070006169A1 (en) Method and apparatus for binding TPM keys to execution entities
TW202036347A (en) Method and apparatus for data storage and verification
TW201633207A (en) Device keys protection
US9893882B1 (en) Apparatus, system, and method for detecting device tampering
CN104335548A (en) Secure data processing
US11575672B2 (en) Secure accelerator device pairing for trusted accelerator-to-accelerator communication
US20210091945A1 (en) Key Processing Method and Apparatus
TW201530344A (en) Application program access protection method and application program access protection device
US11704442B2 (en) Instance handling of a trusted execution environment
US11520859B2 (en) Display of protected content using trusted execution environment
CN110932853B (en) Key management device and key management method based on trusted module
KR20210089486A (en) Apparatus and method for securely managing keys
US10824766B2 (en) Technologies for authenticated USB device policy enforcement
JP6741236B2 (en) Information processing equipment
EP4254855A1 (en) A device and a method for controlling use of a cryptographic key
US11784978B2 (en) Method for establishing remote work environment to ensure security of remote work user terminal and apparatus using the same

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: 20965658

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: 20965658

Country of ref document: EP

Kind code of ref document: A1