Control methods for AI interactive toys, and AI interactive toys, media, and devices.

CN122575352APending Publication Date: 2026-08-14GUANGXI XINGXIA DIMENSION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-20
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

[0003]但当前方案对云端强依赖,由于以ESP32为代表的常用主控仅具备约400KB静态随机存取存储器(Static Random-Access Memory,SRAM),无法完整加载和运行AI对话模型,因此只能将核心推理任务置于云端,一旦网络信号不佳或处于无网络环境,设备丧失核心交互能力,且云端往返存在明显延迟,交互卡顿感明显

Benefits of technology

[0020]本申请所提供的一种AI互动玩具的控制方法,预先将目标AI互动模型按模型结构层将权重拆分为独立数据块,存入非易失性存储器,根据各数据块的存储地址与元数据,在运行内存中建立层级推理索引表,在运行内存中划分权重缓冲区与张量工作区,待处理的输入张量存入张量工作区,按序将当前层权重数据块从非易失性存储器传输至权重缓冲区,利用权重缓冲区中的权重数据,对张量工作区中的输入张量执行预设的神经网络层运算,生成输出张量并更新张量工作区,当前层计算完成后,将权重缓冲区标记为可覆盖,触发下一层权重传输以覆写该区域,直至所有层处理完成,将最终输出张量转换为回复信息输出。本申请运行内存占用从加载完整模型权重降低为仅承载单层权重数据块,使得内存受限的嵌入式平台能够运行原本无法承载的大模型;基于层级推理索引表按模型结构层的语义顺序进行权重数据的流式传输与加载,单层权重加载完成后立即执行该层计算,无需额外查询或等待,提高处理效率;张量工作区中的输出张量在更新时覆写上一层的输入张量所占用的内存区域,不累积历史处理结果,进一步降低张量存储的内存需求;整个过程在设备本地完成,无需依赖网络或云端服务器,使设备在无网络环境下仍可正常使用。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122575352A_ABST
    Figure CN122575352A_ABST
Patent Text Reader

Abstract

This application discloses a control method for AI interactive toys, as well as AI interactive toys, media, and devices; relating to the field of voice interaction devices, it addresses the dependence of AI dialogue devices on networks and improves the smoothness of interaction. Weights are pre-divided into independent data blocks according to the model structure layers and stored in non-volatile memory. In the runtime memory, input tensors are stored in the tensor working area, and weight data blocks are transferred to the weight buffer. Using the weight data in the weight buffer, operations are performed on the input tensors in the tensor working area to generate output tensors and update the tensor working area. This triggers the transmission of the next layer's weight data blocks to overwrite this area until all layers have been processed, at which point the final output tensor is converted into a response information output. Calculations are performed only after the weight data blocks of a single layer are loaded, improving processing efficiency; the output tensors in the tensor working area overwrite the memory area of ​​the input tensors of the previous layer during updates, reducing the memory requirements for tensor storage and eliminating reliance on networks or cloud servers.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of voice interaction devices, and in particular to a control method for an AI interactive toy, as well as the AI ​​interactive toy, medium, and device. Background Technology

[0002] Currently, most AI conversational toys are developed based on the ESP32 series main control module, adopting a mainstream architecture that combines device-side wake-up with cloud-based models. The device side completes wake-up word detection and voice acquisition, and the voice signal is wirelessly transmitted to the cloud AI model for semantic understanding and response generation. Then, the audio is synthesized in real time through the text-to-speech (TTS) module and finally output by the speaker.

[0003] However, current solutions are heavily reliant on the cloud. Commonly used controllers, such as the ESP32, only have about 400KB of Static Random-Access Memory (SRAM), insufficient to fully load and run AI dialogue models. Therefore, core inference tasks must be performed in the cloud. If the network signal is poor or there is no network connection, the device loses its core interactive capabilities. Furthermore, there is significant latency in cloud-to-device communication, resulting in noticeable lag. Additionally, real-time text-to-speech (TTS) synthesis, dynamically synthesizing speech after each response text generation, is computationally intensive, time-consuming, and has high latency. Real-time speech synthesis also consumes substantial computing resources, further exacerbating the lag.

[0004] Therefore, how to solve the dependence of AI dialogue devices on the network and improve the smoothness of interaction is a technical problem that urgently needs to be solved by people in this field. Summary of the Invention

[0005] The purpose of this application is to provide a control method for AI interactive toys, as well as AI interactive toys, media, and devices, to solve the dependence of AI dialogue devices on networks and improve the smoothness of interaction.

[0006] To address the aforementioned technical problems, this application provides a control method for an AI interactive toy, comprising: Two storage areas are divided in the running memory: a weight buffer and a tensor working area. Based on the pre-established hierarchical inference index table, the weight data block corresponding to the current computing layer of the target AI interactive model is streamed from non-volatile memory to the weight buffer via direct memory access. Specifically, the weight data of the target AI interactive model is split into multiple independent weight data blocks according to the model structure layer and stored in non-volatile memory respectively. The hierarchical inference index table is established in the running memory based on the storage address and metadata of each weight data block. Obtain the input tensor to be processed and store the input tensor in the tensor working area; wherein the input tensor to be processed is obtained according to the wake-up signal encoding; The current layer weight data in the weight buffer is called, and a preset neural network layer operation is performed on the current input tensor in the tensor working area to generate an output tensor. The output tensor is then used to overwrite the tensor working area as the input tensor for the next layer. After the current layer calculation is completed, the weight buffer is marked as overwriteable, and the process returns to the step of streaming the weight data block corresponding to the current calculation layer of the target AI interactive model from non-volatile memory to the weight buffer via direct memory access to overwrite the weight buffer, until the processing of all network layers is completed. The final output tensor obtained after processing all layers is decoded to generate and output the response information.

[0007] Optionally, in the above-mentioned control method for AI interactive toys, the weight data of the target AI interactive model is divided into multiple independent weight data blocks according to the model structure layer, and stored in non-volatile memory respectively. Based on the storage address and metadata of each weight data block, the hierarchical inference index table is established in the running memory, including: An independent storage directory is established in the non-volatile memory for each preset character AI interactive model; The weight data of each network layer of the AI ​​interactive model for each preset character is encapsulated into independent, directly addressable binary weight data blocks, and a configuration file is generated. The configuration file records at least the total number of layers of the model, the physical starting address of each weight data block in the non-volatile memory, the data length, and the calculation order. During device initialization, the configuration file is parsed, and the physical starting address, data length, and corresponding tensor dimension of each layer's weight data block are mapped into an ordered array and stored in the running memory as the layer inference index table.

[0008] Optionally, in the above control method for AI interactive toys, the storage space of the weight buffer is not less than the size of the largest weight data block; Correspondingly, the weight data block corresponding to the current computation layer of the target AI interactive model is streamed from non-volatile memory to the weight buffer via direct memory access, including: Query the hierarchical inference index table to obtain the physical starting address and data length of the weight data block corresponding to the current layer; Without consuming central processing unit resources, a direct memory access request is initiated, controlling the non-volatile memory to directly transmit the weight data block to the weight buffer in the form of a data stream.

[0009] Optionally, the control method for the aforementioned AI interactive toy further includes, after initiating a direct memory access request: While the direct memory access transmits the weight data block of the current layer, preset neural network layer operations are performed on the loaded weight data block of the previous layer and / or the input tensor.

[0010] Optionally, in the above-mentioned control method for AI interactive toys, the current layer weight data in the weight buffer is called to perform a preset neural network layer operation on the current input tensor in the tensor working area to generate an output tensor, and the output tensor is used to overwrite the tensor working area as the input tensor of the next layer, including: Map the current layer weight data in the weight buffer to a weight tensor; Read the current input tensor in the tensor working area, perform matrix multiplication and activation function operation with the weight tensor to obtain the output tensor of the current layer; The output tensor of the current layer is overwritten and written to the storage location of the input tensor in the tensor working area to update the data state of the tensor working area, which is then used as the input tensor for the next computation layer.

[0011] Optionally, in the above-described control method for AI interactive toys, the output tensor of the current layer is overwritten and written to the storage location of the input tensor in the tensor working area to update the data state of the tensor working area, which is then used as the input tensor of the next computation layer. This includes: If it is determined that the input tensor is no longer used by any model structure layer after the current layer, the output tensor of the current layer is overwritten into the storage location of the input tensor in the tensor working area to update the data state of the tensor working area, which will then serve as the input tensor for the next computation layer.

[0012] Optionally, the control method for the above-mentioned AI interactive toys also includes: In response to the received character switching command, determine the target character; Read the configuration file corresponding to the target persona from the non-volatile memory, and refresh the hierarchical reasoning index table in the running memory according to the configuration file corresponding to the target persona; Under the scheduling of the refreshed hierarchical inference index table, the step of streaming the weight data block corresponding to the current computing layer of the target AI interactive model from non-volatile memory to the weight buffer via direct memory access, based on the pre-established hierarchical inference index table.

[0013] Optionally, in the above-mentioned control method for AI interactive toys, the final output tensor obtained after processing all layers is decoded to generate and output response information, including: The final output tensor is decoded to obtain the response text; Based on a pre-set library of voice segments corresponding to the current target persona, the reply text is converted into a voice signal, or the reply text is converted into a voice signal in real time through a text-to-speech module; The audio signal is played through a speaker driven by an audio power amplifier.

[0014] Optionally, the control method for the above-mentioned AI interactive toys also includes: While outputting the voice signal, the facial expression image of the target persona corresponding to the reply text is acquired; The emoticon image and / or the reply text are displayed synchronously on the display screen.

[0015] To address the aforementioned technical problems, this application also provides an AI interactive toy, comprising: The main control module includes running memory and a storage interface; A non-volatile memory, connected to the main control module, is used to store weight data blocks of multiple AI interactive models according to the model structure layer; A voice acquisition module, connected to the main control module, is used to acquire user voice signals; A voice output module, connected to the main control module, is used to output voice signals; The display module, connected to the main control module, is used to display images and / or text; The main control module is used to execute the control method of the AI ​​interactive toy described above.

[0016] Optionally, in the above-mentioned AI interactive toy, the voice acquisition module includes a digital microphone, and the digital microphone is connected to the main control module via an I2S digital audio bus interface.

[0017] Optionally, in the above-mentioned AI interactive toy, the non-volatile memory is an external Flash memory, which is connected to the main control module via an SPI interface.

[0018] To address the aforementioned technical problems, this application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the aforementioned AI interactive toy control method.

[0019] To address the aforementioned technical problems, this application also provides a reasoning computing device for an AI interactive toy, comprising: Memory, used to store computer programs; A processor is used to implement the steps of the above-described control method for an AI interactive toy when executing the computer program.

[0020] The control method for an AI interactive toy provided in this application pre-divides the weights of the target AI interactive model into independent data blocks according to the model structure layers and stores them in non-volatile memory. Based on the storage address and metadata of each data block, a hierarchical inference index table is established in the running memory. A weight buffer and a tensor working area are divided in the running memory. The input tensor to be processed is stored in the tensor working area. The weight data blocks of the current layer are sequentially transferred from the non-volatile memory to the weight buffer. Using the weight data in the weight buffer, a preset neural network layer operation is performed on the input tensor in the tensor working area to generate an output tensor and update the tensor working area. After the current layer calculation is completed, the weight buffer is marked as overwriteable, triggering the next layer weight transfer to overwrite the area, until all layers are processed, and the final output tensor is converted into response information output. This application reduces the memory footprint of loading full model weights to only loading single-layer weight data blocks, enabling memory-constrained embedded platforms to run large models that were previously unusable. Based on a hierarchical inference index table, weight data is streamed and loaded according to the semantic order of the model structure layers. Once a single layer's weights are loaded, the calculation for that layer is executed immediately without additional queries or waiting, improving processing efficiency. When the output tensor in the tensor working area is updated, it overwrites the memory area occupied by the input tensor of the previous layer, without accumulating historical processing results, further reducing the memory requirements for tensor storage. The entire process is completed locally on the device, without relying on a network or cloud server, allowing the device to function normally even without a network connection.

[0021] In addition, this application also provides an AI interactive toy, a computer-readable storage medium, and an inference computing device for an AI interactive toy, which correspond to the control method of the aforementioned AI interactive toy and have the same effect. Attached Figure Description

[0022] To more clearly illustrate the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0023] Figure 1 A flowchart illustrating a control method for an AI interactive toy provided in this application embodiment; Figure 2 A schematic diagram of an AI interactive toy provided as an embodiment of this application; Figure 3 A circuit diagram of a main control module provided for an embodiment of this application; Figure 4 A circuit diagram of a voice acquisition circuit provided in an embodiment of this application; Figure 5 A circuit diagram of a storage module provided in an embodiment of this application; Figure 6 A circuit diagram of a button module circuit provided in an embodiment of this application; Figure 7 This is a structural diagram of a reasoning computing device for another AI interactive toy provided in an embodiment of this application.

[0024] The annotations in the attached figures are explained as follows: 11-Main control module; 12-Non-volatile memory; 13-Voice acquisition module; 14-Voice output module; 15-LCD display screen. Detailed Implementation

[0025] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of this application.

[0026] The core of this application is to provide a control method for AI interactive toys, as well as AI interactive toys, media, and devices.

[0027] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0028] This application provides a method for controlling an AI interactive toy, such as... Figure 1 As shown, it includes: S11: Two storage areas are allocated in the running memory, namely the weight buffer and the tensor working area; S12: Based on the pre-established hierarchical inference index table, the weight data block corresponding to the current computing layer of the target AI interactive model is streamed from non-volatile memory to the weight buffer via direct memory access; wherein, based on the weight data of the target AI interactive model, it is split into multiple independent weight data blocks according to the model structure layer, which are stored in non-volatile memory respectively, and a hierarchical inference index table is established in the running memory according to the storage address and metadata of each weight data block; S13: Obtain the input tensor to be processed and store the input tensor in the tensor working area; wherein, the input tensor to be processed is obtained according to the wake-up signal encoding; S14: Call the current layer weight data in the weight buffer, perform the preset neural network layer operation on the current input tensor in the tensor working area, generate the output tensor, and use the output tensor to overwrite the tensor working area as the input tensor of the next layer; S15: After the current layer calculation is completed, mark the weight buffer as overwriteable and return to the step of streaming the weight data block corresponding to the current calculation layer of the target AI interactive model from non-volatile memory to the weight buffer via direct memory access to overwrite the weight buffer until the processing of all network layers is completed. S16: Decode the final output tensor obtained after processing all layers, generate and output the response information.

[0029] This embodiment provides a control method for an AI interactive toy, which runs on an embedded device including a main control chip, non-volatile memory, a microphone, and a speaker. The main control chip integrates running memory, and the non-volatile memory is used to store weight data of the AI ​​interactive model. Specifically, the AI ​​interactive toy is an AI smart interactive badge.

[0030] First, the weight data of the target AI interactive model needs to be pre-split into multiple independent weight data blocks according to the model structure layers. A model structure layer refers to the basic computational unit of an AI model, such as the self-attention layer or feedforward network layer in a Transformer model (a type of deep learning model). Each weight data block corresponds to a complete network layer, containing all the trainable parameters of that layer. The split weight data blocks are stored separately in non-volatile memory. The purpose of this step is to avoid storing the complete model as a single file, laying the foundation for subsequent layer-by-layer loading.

[0031] Simultaneously, a hierarchical inference index table is built in runtime memory based on the storage address and metadata of each weight data block. The storage address refers to the physical starting location of each weight data block in non-volatile memory; the metadata may include the size of each weight data block, the corresponding layer number, and the dimension information of the input and output tensors of that layer. This index table can be an ordered array, where the i-th element points to the storage location and attribute information of the weight data of the i-th layer.

[0032] Step S11 pre-divides the runtime memory into a weight buffer and a tensor working area. The weight buffer is used to temporarily store the weight data blocks of the current computation layer, and its size is set to be no less than the largest of all weight data blocks; the tensor working area is used to store tensor data during the computation process. The input tensor generated in the previous step is stored in the tensor working area as the initial input data.

[0033] Step S12, based on the hierarchical inference index table, sequentially streams the weight data blocks corresponding to the current computation layer from the non-volatile memory to the weight buffer, according to the layer number from smallest to largest. Streaming refers to reading continuously as a data stream, rather than reading all data at once. Each transmission only moves the weight data of the layer that needs to be computed to the weight buffer.

[0034] After powering on, the device enters standby mode. When the user speaks a preset wake-up word, the device receives a voice wake-up signal. Subsequently, the device captures the user's voice signal through the microphone and converts the voice signal into input text. This conversion can be achieved through a local Automatic Speech Recognition (ASR) model, which runs on the device itself and does not require a network connection.

[0035] After obtaining the input text, it is vectorized and encoded to generate an input tensor. Vectorization is the process of mapping discrete text symbols into continuous numerical vectors, such as converting each word into a fixed-length vector sequence using a word embedding table.

[0036] In practical applications, wake-up signals can be linguistic information, text information, image information, etc. The corresponding encoding conversion method is set based on the wake-up signal type to convert it into an input tensor.

[0037] Step S14 uses the current layer weight data in the weight buffer to perform preset neural network layer operations on the input tensor in the tensor working area, generating an output tensor and updating the tensor working area. The preset neural network layer operations depend on the specific structure of the model and may include matrix multiplication, bias addition, activation function calculation, etc. The output tensor is stored back in the tensor working area, replacing the original input tensor.

[0038] Step S15, after the current layer calculation is completed, marks the weight buffer as overwriteable. This marking is a logical memory management operation and is not limited to modifying the flags of a specific memory management unit. For example, it could simply reset a write pointer to that memory region, or allow subsequent Direct Memory Access (DMA) transfer events to directly modify that region. The core idea is to remove data protection from that memory region, allowing it to be directly overwritten by subsequent new layer weight data.

[0039] Marking a memory region as overwriteable means that its contents no longer need to be retained; subsequent data writes can directly overwrite this region without requiring explicit memory clearing. This triggers the transfer of the next layer's weight data blocks, with the new weight data being written directly to the weight buffer, overwriting the existing data. This process is repeated, sequentially loading, calculating, updating, and overwriting the weight buffer for each layer, until all model structure layers are processed, yielding the final output tensor.

[0040] It should be noted that the core of this embodiment lies in reducing the runtime memory usage from the size of the entire model weights to the size of a single layer weights through layer-by-layer loading and memory overwriting mechanisms. For deep models with dozens of layers, this reduction is orders of magnitude. This does not mean that the method described in this embodiment is limited to Transformer structures; it is applicable to any layered feedforward computation graph.

[0041] Finally, step S16 converts the final output tensor into response information for output. This conversion process is the reverse of the input conversion process, typically involving mapping the output tensor to a probability distribution in the vocabulary, selecting the word or word sequence with the highest probability to form the response text in natural language, and then playing it through a speaker or displaying it on the screen. TTS segmentation is an optimization method of Text-to-Speech (TTS) technology. It pre-records and stores segments of speech with a preset two-dimensional voice. When the response text is generated, the corresponding segments are called and spliced ​​into complete speech, avoiding the delay of real-time synthesized speech and improving the smoothness of interaction.

[0042] This embodiment, through the steps described above, enables the running of large-scale AI models on memory-constrained embedded platforms. Compared to existing technologies that load the entire model into memory at once, this embodiment significantly reduces peak memory usage. Furthermore, since the entire process is completed locally on the device without relying on a cloud server, it can function normally even without a network connection, while avoiding the latency and uncertainties associated with network transmission.

[0043] In summary, the control method for an AI interactive toy provided in this application pre-divides the weights of the target AI interactive model into independent data blocks according to the model structure layers and stores them in non-volatile memory. Based on the storage address and metadata of each data block, a hierarchical inference index table is established in the running memory. A weight buffer and a tensor working area are divided in the running memory. The input tensor to be processed is stored in the tensor working area. The weight data blocks of the current layer are sequentially transferred from the non-volatile memory to the weight buffer. Using the weight data in the weight buffer, a preset neural network layer operation is performed on the input tensor in the tensor working area to generate an output tensor and update the tensor working area. After the current layer calculation is completed, the weight buffer is marked as overwriteable, triggering the next layer weight transfer to overwrite the area, until all layers are processed, and the final output tensor is converted into response information output. This application reduces the memory footprint of loading full model weights to only loading single-layer weight data blocks, enabling memory-constrained embedded platforms to run large models that were previously unusable. Based on a hierarchical inference index table, weight data is streamed and loaded according to the semantic order of the model structure layers. Once a single layer's weights are loaded, the calculation for that layer is executed immediately without additional queries or waiting, improving processing efficiency. When the output tensor in the tensor working area is updated, it overwrites the memory area occupied by the input tensor of the previous layer, without accumulating historical processing results, further reducing the memory requirements for tensor storage. The entire process is completed locally on the device, without relying on a network or cloud server, allowing the device to function normally even without a network connection.

[0044] Specifically, based on the weight data of the target AI interactive model, it is split into multiple independent weight data blocks according to the model structure layer, and stored in non-volatile memory respectively. A hierarchical inference index table is then built in runtime memory based on the storage address and metadata of each weight data block, including: For each pre-defined AI interactive model, an independent storage directory is established in non-volatile memory; The weight data of each network layer of the AI ​​interactive model for each preset character is encapsulated into independent, directly addressable binary weight data blocks, and a configuration file is generated. The configuration file records at least the total number of layers of the model, the physical starting address of each weight data block in non-volatile memory, the data length, and the calculation order. During device initialization, the configuration file is parsed, and the physical starting address, data length, and corresponding tensor dimension of each layer's weight data block are mapped into an ordered array and stored in the runtime memory as a hierarchical inference index table.

[0045] This embodiment further defines the organization method of the weighted data and the method of establishing the index table.

[0046] First, a separate storage directory is established in non-volatile memory for each target AI interactive model with a specific character designation. A character designation refers to the personality of the role played by the AI ​​interactive toy. This embodiment supports switching between multiple different character designs, such as cute, mature, and energetic. Each character designation has its own independent directory in the storage space, such as a character A directory and a character B directory.

[0047] In each user profile's directory, the weight data for each network layer of the AI ​​model corresponding to that user profile is packaged into independent binary files. For a 16-layer model, 16 binary files will be generated, named, for example, the first layer weight file, the second layer weight file, and so on. Additionally, a configuration file is generated in the same directory. This configuration file records the model's metadata, including the total number of layers, the physical starting address of each weight data block, the data length of each data block, and the loading order of each layer during inference, i.e., the computation order. The physical starting address can be obtained directly from the file system or through a fixed allocation during the burning process.

[0048] Based on this, the specific method for establishing the hierarchical inference index table in runtime memory is as follows: The configuration file is parsed, mapping the physical starting address, data length, and corresponding tensor dimension of each weight data block into an ordered array. Each element of this array corresponds to a layer of the model, containing complete location information of the weight data for that layer. Since the length of the array is equal to the total number of layers in the model, and the indexes are arranged by layer number, during layer-by-layer inference, the main control chip only needs to directly access the corresponding position in the array based on the current layer number, without needing to perform string lookups or hash calculations, resulting in high scheduling efficiency.

[0049] This embodiment encapsulates weights into independent binary files, enabling direct memory access reads from specified addresses during streaming without requiring protocol parsing at the file system level, further reducing read latency. The combination of configuration files and index tables transforms storage-level information into a fast in-memory lookup structure, providing an efficient data foundation for subsequent layer-by-layer scheduling. Based on this, this embodiment maintains the real-time performance of inference scheduling while supporting multi-task switching.

[0050] Specifically, the storage space of the weight buffer is not less than the size of the largest weight data block; Correspondingly, the weight data block corresponding to the current computation layer of the target AI interactive model is streamed from non-volatile memory to the weight buffer via direct memory access, including: Query the hierarchical inference index table to obtain the physical starting address and data length of the weighted data block corresponding to the current layer; Without consuming CPU resources, a direct memory access request is initiated, controlling the non-volatile memory to directly transfer weight data blocks to the weight buffer in the form of a data stream.

[0051] The weight buffer refers to a memory region that is repeatedly used throughout the inference process, and its contents dynamically change depending on the current computation layer. The size of this buffer is set to be no less than the size of the largest weight data block. That is, if the weights in different layers of the model are not exactly the same size, the buffer capacity is allocated based on the layer with the largest weight. For example, in a 16-layer Transformer model, if the weight data block size of a fully connected layer is 640 kilobytes, and the weights of all other layers are smaller than or equal to this value, then the weight buffer size is set to 640 kilobytes or slightly larger than this value.

[0052] In actual operation, the process of sequentially transferring the weight data blocks corresponding to the current computation layer from non-volatile memory to the weight buffer in hierarchical order includes the following two sub-steps: The first step is to query the hierarchical inference index table to obtain the physical starting address and data length of the weight data block corresponding to the current layer. Since the index table has already been built in the runtime memory, this query operation only requires reading a few values ​​from memory, and the time consumption is extremely short.

[0053] The second step involves initiating a direct memory access request, controlling the non-volatile memory to directly transfer the weighted data block to the weight buffer as a data stream. Direct memory access is a data transfer mechanism that does not require the central processing unit (CPU) to move data byte by byte. The CPU only needs to inform the memory controller of the source address, destination address, and data length, and the controller automatically completes the data transfer, notifying the CPU via an interrupt or flag upon completion. During this process, the CPU can handle other tasks or enter a low-power wait state. In this embodiment, the direct memory access request is issued through the serial peripheral interface bus. After receiving the instruction, the external flash memory chip continuously reads data starting from the specified address and of the specified length, directly writing it into the weight buffer.

[0054] It should also be noted that this embodiment does not strictly limit the specific type of bus. A serial peripheral interface bus is a common choice due to its fewer pins, higher speed, and support by most flash memory chips. However, this does not mean that other bus interfaces cannot achieve the same functionality.

[0055] We employ a weight buffer and direct memory access for data transfer. The weight buffer has a fixed capacity that does not increase with the number of model layers. Direct memory access allows weight loading and CPU computation to partially overlap; that is, while loading the weights for layer N+1, the CPU can compute the weights for layer N, thus hiding some transmission latency. The CPU does not need to participate in data transfer and can devote all its computing resources to matrix operations, improving overall inference efficiency.

[0056] Specifically, after initiating a direct memory access request, the following steps are also included: While directly accessing and transmitting the weight data block of the current layer, pre-defined neural network layer operations are performed on the loaded weight data block of the previous layer and / or input tensors.

[0057] Transmission and computation are parallel or partially overlapping, and DMA combined with streaming loading brings efficiency improvements.

[0058] Specifically, the current layer weight data in the weight buffer is called, and a preset neural network layer operation is performed on the current input tensor in the tensor working area to generate an output tensor. This output tensor is then used to overwrite the tensor working area as the input tensor for the next layer, including: Map the current layer weight data in the weight buffer to a weight tensor; Read the current input tensor from the tensor working area, perform matrix multiplication and activation function operations with the weight tensor to obtain the output tensor of the current layer; The output tensor of the current layer is overwritten into the storage location of the input tensor in the tensor working area to update the data state of the tensor working area, which will then serve as the input tensor for the next computation layer.

[0059] First, the current layer's weight data in the weight buffer is mapped to a weight tensor. This step essentially involves interpreting the contiguous weight values ​​stored in memory according to the tensor shape defined for that layer. For example, if the weights of a fully connected layer are a matrix of input dimensions multiplied by the output dimension, the mapping operation reorganizes the byte sequence in the weight buffer into this matrix structure. In implementation, this mapping is usually done through pointer type conversion and does not involve actual data copying. Specifically, the central processing unit (CPU) queries the layer 0 metadata in the layer inference index table to obtain the starting address (0x00100000) and data length (512KB) of the layer 0 weight data in Flash (a non-volatile memory device). Then, a high-speed DMA (Direct Memory Access) read request is initiated through the Serial Peripheral Interface (SPI) bus, instructing Flash to directly transfer the contiguous 512KB of data, starting from address 0x00100000, to the weight buffer in Static Random Access Memory (SRAM) in a stream format. This process does not require the CPU to move data byte by byte, greatly improving efficiency. After the DMA transfer is complete, the weight buffer contains the complete layer 0 weight data. The inference engine maps this memory region to a layer 0 weight tensor. It is understood that the above-described method of streaming via DMA initiated through the SPI bus is merely a preferred embodiment of this invention. Those skilled in the art, inspired by the concept of this invention, may use other bus interfaces or batch data transfer via processor polling, as long as it conforms to the core idea of ​​layer-by-layer transmission and layer-by-layer coverage, and all such methods should fall within the protection scope of this invention.

[0060] Then, the current input tensor is read from the tensor working area. In the first computation layer, the input tensor is the text embedding vector converted from the user's speech; starting from the second computation layer, the input tensor is the output tensor of the previous layer. Preset operations are performed on this input tensor and the weight tensor obtained in the previous step. The preset operations may differ for different model layers: self-attention layers involve matrix multiplication of queries, keys, and values, as well as normalization calculation of attention weights; feedforward network layers typically contain two consecutive matrix multiplications with a non-linear activation function in between; normalization layers involve mean and variance calculations and linear transformations. This embodiment does not limit the specific type of operation, as long as the operator conforms to the model's structural definition.

[0061] Specifically, the inference engine reads the initial input tensor from the tensor working area (which is the tensor after the prompt has been processed by the word embedding module), and the weight tensor of layer 0 in the weight buffer, and executes the algorithm defined for that layer (e.g., matrix multiplication, addition bias, activation function calculation).

[0062] After the computation is complete, the output tensor of the current layer is obtained. The dimension of the output tensor is determined by the model structure, for example, a tensor with a batch size of 1, a sequence length of 32, and a feature dimension of 512. Subsequently, this output tensor is written to the storage location of the input tensor in the tensor working area, overwriting its contents. In other words, the output tensor does not require allocating a new memory area; instead, it is directly written to the memory block that originally stored the input tensor, replacing its contents. This achieves the data state update of the tensor working area, and the updated data serves as the input tensor for the next computation layer.

[0063] Specifically, once the current layer (layer 0) has completed its computation, it generates an output tensor. This output tensor is immediately moved to the designated position in the tensor job, overwriting any old input tensors that are no longer needed. It then becomes the input for the next layer (layer 1).

[0064] It's important to note that the practice of overwriting input tensors with output tensors has preconditions. In a layer-by-layer feedforward computation graph, once the output of the current layer is generated, the input of the previous layer is no longer used by any subsequent steps, thus the memory it occupies can be safely reclaimed. This embodiment leverages this principle by designing the tensor working area as a rolling update working area; this step is essentially memory reuse.

[0065] The advantage of this update method is that, regardless of the number of layers in the model, the tensor working space always only stores the input tensors necessary for the current layer, with at most a small amount of temporary buffering. It avoids accumulating intermediate results from all layers as the number of layers increases, thus keeping the memory overhead of tensor storage at a constant level.

[0066] Specifically, if it is determined that the input tensor is no longer used by any model structure layer after the current layer, the output tensor of the current layer is written to the storage location of the input tensor in the tensor working area to update the data state of the tensor working area, and then used as the input tensor of the next computation layer.

[0067] This means that once the input tensor of the current layer completes its computation, its lifetime ends and it will not be referenced by any subsequent computation layers. This premise is an inherent property of feedforward neural network computation. By utilizing this, memory space can be safely reclaimed and reused, avoiding data dependency errors caused by erroneous overwriting.

[0068] Specifically, it also includes: In response to the received character switching command, determine the target character; Read the configuration file corresponding to the target persona from non-volatile memory, and refresh the hierarchical inference index table in the runtime memory according to the configuration file corresponding to the target persona; Under the scheduling of the refreshed hierarchical inference index table, the step of streaming the weight data block corresponding to the current computing layer of the target AI interactive model from non-volatile memory to the weight buffer through direct memory access, based on the pre-established hierarchical inference index table.

[0069] First, users can issue character switching commands via voice or physical buttons. For example, if a user says "switch to [character name]", the device will use voice recognition to obtain the command content and parse out the name of the target character.

[0070] In response to the persona switching command, the device retrieves the configuration file corresponding to the target persona. Since each persona has an independent storage directory in non-volatile memory, containing its own configuration file, the file can be read from memory simply by constructing the path to the configuration file based on the name of the target persona.

[0071] After reading the configuration file, the hierarchical inference index table is updated according to the configuration file corresponding to the target persona. The update operation includes: parsing the contents of the new configuration file, extracting the total number of layers in the model, the physical starting address of the weight data of each layer, the data length, and the loading order; and refilling the ordered array in the runtime memory with this new data, replacing the original index table contents. This operation is lightweight because the index table itself occupies very little memory, typically only a few thousand bytes.

[0072] Under the scheduling of the updated hierarchical inference index table, the device executes the sequential streaming of the weight data blocks corresponding to the current computation layer from non-volatile memory to the weight buffer, and performs subsequent inference calculations. Since the index table already points to the weight data of the new character design, the model corresponding to the new character design will naturally be loaded subsequently.

[0073] Additionally, after a persona switch, the input tensors in the tensor working area may no longer be applicable to the new model. Therefore, this also includes: at the moment the switch is completed, the device will clear or reset the state of the tensor working area, waiting for the next user voice input.

[0074] From the perspective of the overall solution, the core of character switching lies in the independent storage of resources and the dynamic redirection of the index table. This embodiment does not merge the models of different character designs into a larger model, nor does it rewrite the memory during switching. Instead, it achieves fast switching by changing the index pointer, which makes the switching latency very small and the user-perceived waiting time very short.

[0075] Specifically, the final output tensor obtained after processing all layers is decoded to generate and output response information, including: The final output tensor is decoded to obtain the response text. Based on the pre-set voice segment library corresponding to the current target persona, the reply text is converted into a voice signal, or the reply text is converted into a voice signal in real time through the text-to-speech module; The audio power amplifier drives the speaker to play the voice signal.

[0076] First, the final output tensor is decoded to obtain the response text. The decoding process is the reverse of the input encoding. The final output tensor is typically a two-dimensional matrix, where each row corresponds to a position in the predicted sequence and each column corresponds to a word in the vocabulary. For example, the shape of the output tensor is the sequence length multiplied by the vocabulary size, representing the generation probability of each word at each position. The decoding process involves selecting one or more words with the highest probabilities from the probability distribution of each row to form a complete text sequence.

[0077] After decoding the reply text, it is converted into an audible speech signal. There are two specific implementation methods: The first method uses a pre-built library of speech segments. Commonly used Chinese characters, words, and interjections are pre-recorded as speech segments according to the current persona, and stored in non-volatile memory. During conversion, the response text is segmented, mapping each word to its corresponding speech segment, and these segments are then sequentially concatenated into a continuous speech waveform sequence. The advantage of this method is its fast speech synthesis speed with virtually no computational overhead. The disadvantage is its limited vocabulary coverage; it cannot handle words not pre-recorded.

[0078] The second method uses a text-to-speech module. This module is an algorithm running on the main control chip that directly synthesizes text into speech signals. Text-to-speech modules do not require a pre-recorded dictionary and can synthesize any text, but the computational load is relatively large, and the synthesis latency is slightly higher.

[0079] After receiving the voice signal, it is sent to an audio power amplifier for amplification. Audio power amplifiers typically employ Class D amplifiers due to their high efficiency and low heat generation, making them suitable for battery-powered portable devices. The amplified signal is sufficient to drive a speaker, which then emits sound, allowing the user to hear a response voice that matches the user's current vocal signature. Class D amplifiers use pulse width modulation (PWM) technology to convert digital signals into analog audio signals, making them suitable for audio amplification in low-power smart toys.

[0080] Speech synthesis is a relatively time-consuming operation in embedded systems. Pre-built segment libraries can significantly reduce latency, while text-to-speech modules can ensure vocabulary completeness. These two complement each other, achieving a balance between latency and coverage, thereby improving the user experience.

[0081] Specifically, it also includes: While outputting the voice signal, the system acquires the facial expression image corresponding to the target persona in the reply text. Display emojis and / or reply text synchronously on the display screen.

[0082] Based on the received reply text, the device controls the display screen to synchronously display corresponding visual content according to the currently selected target persona and the specific content of the reply text. The display screen can be an LCD screen or an OLED screen; this embodiment is not strictly limited to either.

[0083] The displayed content consists of at least two parts. The first part is the emoticon image for the current character. The emoticon image is strongly correlated with the character; for example, a cute character might correspond to a big-eyed smiling face, while a mature, sophisticated character might correspond to a confident smile. More importantly, the emoticon image can dynamically switch based on the tone and emotional content of the reply text. For example, a happy emoticon is displayed when the reply text is affirmative or praising, and an apologetic emoticon is displayed when the reply text is a polite refusal. This dynamic switching requires designing a set of emoticon images for each character in advance and establishing a mapping rule between text emotion and emoticon.

[0084] The second part is the text display of the response. The response text is displayed as subtitles at the bottom of the screen or in a speech bubble, making it easy for users to read when they cannot listen or need to confirm the content. The text display uses a large font and clear contrast to ensure readability at the typical usage distance of the toy.

[0085] In this embodiment, voice output and screen display are synchronized; that is, while the speaker plays the voice, the screen simultaneously changes to display the corresponding emoticons and text. This synchronized interaction method enhances the user's immersion, making the user feel as if they are conversing with a virtual character with personality and expressions, rather than just a voice box.

[0086] In summary, this embodiment combines voice response with visual feedback, enriching the interactive dimensions through screen display and enhancing the fun and approachability of AI interactive toys.

[0087] This application also provides an AI interactive toy, such as... Figure 2 As shown, it includes: Main control module 11 includes running memory and storage interface; The non-volatile memory 12 is connected to the main control module 11 and is used to store multiple independent weight data blocks of the target AI interactive model according to the model structure layer. The voice acquisition module 13 is connected to the main control module 11 and is used to acquire user voice signals; The voice output module 14 is connected to the main control module 11 and is used to output voice signals; Display module 15, connected to main control module 11, is used to display images and / or text; The main control module is used to execute the control methods of the AI ​​interactive toy described above.

[0088] The main control module integrates running memory and a memory interface. The main control module can be an embedded microcontroller or microprocessor, and the size of its running memory determines the scale of the models that can be run. This embodiment does not limit the specific chip model; any embedded chip with sufficient running memory and suitable peripheral interfaces is applicable. Specifically, the ESP32 is used as the main control module.

[0089] The non-volatile memory is connected to the main control module via a memory interface. This memory is used to store multiple independent weight data blocks of the target AI interactive model according to the model structure layer. That is, the model weights are not stored as a single file, but are split into multiple independent weight data blocks and stored separately according to the control method described above. The memory interface can be a high-speed bus interface such as a serial peripheral interface or a four-wire serial peripheral interface to ensure the bandwidth for streaming transmission. Specifically, a Flash chip is used.

[0090] The voice acquisition module is connected to the main control module and is used to collect voice signals emitted by the user. The core component of the voice acquisition module is the microphone, which converts sound waves into electrical signals, which are then sent to the main control module after analog-to-digital conversion.

[0091] A liquid crystal display (LCD) screen can be a thin-film transistor liquid crystal display (TFT-LCD) or a simpler monochrome LCD screen. The LCD screen is connected to the main control module via a display interface, such as a serial peripheral interface or a parallel interface.

[0092] The LCD screen is used to display images and text. Images mainly refer to emoticons, and text mainly refers to reply text. In practice, the screen can display both simultaneously or switch between different interfaces depending on the interaction status. For example, in standby mode, it displays the standby icon or the current character's avatar; during interaction, it displays animated emoticons and the reply text being generated; and in sleep mode, it turns off the backlight or completely turns off the screen to save power.

[0093] This embodiment does not impose strict limitations on screen size and resolution. In principle, as long as expressions and text can be clearly displayed, it is acceptable. For products in the form of a badge, a 1.75-inch screen is suitable. While the display module is not a necessary component for voice interaction, it enhances the user experience, making the interaction process more intuitive and engaging.

[0094] The main control module is used to execute the above control methods. In other words, the program code for implementing the above methods is burned into non-volatile memory or the internal read-only memory of the main control chip during the manufacturing process of the toy, and these steps are automatically executed when the device is running.

[0095] It also includes: a power module, which powers the lithium battery and provides a stable 3.3V power supply to the entire device through a voltage regulator circuit; and a button module, which includes a BOOT programming button and a reset button, which are connected to the BOOT pin and EN pin of the main control module, respectively, to realize programming and manual reset functions.

[0096] Specific AI interactive toys also include: a voice acquisition module including a digital microphone, which is connected to the main control module via an I2S digital audio bus interface.

[0097] The voice acquisition module includes a digital microphone. Unlike traditional analog microphones, the digital microphone integrates an analog-to-digital converter (ADC) circuit, directly outputting pulse-code modulated digital audio signals. Therefore, a separate ADC is not required in the main control module. The digital microphone connects to the main control module via a digital audio bus interface. The digital audio bus interface is a bus standard specifically designed for transmitting digital audio data, including clock lines, frame synchronization lines, and data lines. Through this interface, the digital microphone can directly send sampled audio data to the main control module; the data format is typically time-division multiplexed data for two channels.

[0098] The voice output module is connected to the main control module and is used to output voice signals. The voice output module may include an audio power amplifier and a speaker. The audio power amplifier receives the audio digital signal or pulse width modulation signal output from the main control module and amplifies it to a power level sufficient to drive the speaker.

[0099] The reason for using a digital microphone in this embodiment is that the signal output by a digital microphone has already undergone analog-to-digital conversion at the source, resulting in stronger anti-interference capabilities and a higher signal-to-noise ratio, making it suitable for use in toy products in complex radio frequency environments. At the same time, eliminating the need for a separate analog-to-digital converter also helps reduce material costs and requires less circuit board space, which is especially important for small-sized badge-like products.

[0100] This application specifically provides an I2S interface to realize a serial bus interface for transmitting audio data between digital audio devices, used to connect a digital silicon microphone and an ESP32 main controller to realize the acquisition and transmission of voice signals.

[0101] In specific AI interactive toys, the non-volatile memory is an external Flash memory, which is connected to the main control module through a Serial Peripheral Interface (SPI) interface.

[0102] By using an external Flash memory, storage time is flexible, and users can choose external Flash memory of different capacities according to their needs without changing the main control module.

[0103] The hardware system of this application uses ESP32 as the core of the main control module. This main control chip has 16MB of built-in Flash and 8MB of SRAM, and has rich peripheral interfaces, which can meet the low power consumption and high interactivity requirements of this application. Its specific circuit design is as follows: like Figure 3 As shown, the core circuit of the main control module uses an ESP32 module (U1), with module pins connected to the power, ground, and peripheral interfaces of the circuit board. Specifically, the module's VDD_S and 3V3 pins are connected to a 3.3V power supply, and the GND and other grounding pins are reliably grounded to ensure stable chip operation. The module's EN and BOOT pins are connected to corresponding auxiliary circuits to implement reset and programming functions. The module's I2S interface pins (I2S_CLK, I2S_WS, I2S_DIN) are connected to the voice acquisition module, the DAC pins are connected to the audio output module, the SPI interface pins are connected to the display module and the Flash storage module, and the GPIO pins are connected to the button module.

[0104] like Figure 3 As shown, the crystal oscillator circuit is an external 40MHz passive crystal oscillator. An 18pF load capacitor is connected in parallel across the two ends of the crystal oscillator, and the other end of the capacitor is grounded. The output of the crystal oscillator is connected to the ESP32 main controller to provide a stable clock signal for the chip and ensure that the various modules of the chip work synchronously. The NPO (a capacitor material with high dielectric constant and low loss) material capacitor has the characteristics of stable temperature coefficient and low loss, which can effectively ensure the stability of the crystal oscillator frequency and avoid clock signal deviation caused by temperature changes, thus affecting the operation of the device.

[0105] The reset circuit adopts an RC low-pass reset structure, specifically composed of a 10kΩ pull-up resistor and a 100nF ceramic capacitor. One end of the pull-up resistor is connected to a 3.3V power supply, and the other end is connected to the EN pin of the ESP32 main controller; one end of the ceramic capacitor is connected to the EN pin, and the other end is grounded; at the same time, a test point is reserved on the EN pin for easy debugging later; in addition, a manual reset button is extended, with one end of the button connected to the EN pin and the other end grounded. When the button is pressed, the EN pin level is pulled low, realizing manual reset; this circuit supports automatic power-on reset (when power is on, the capacitor charges, and the EN pin level rises slowly to complete the reset) and manual reset, ensuring that the device can quickly resume normal operation in abnormal situations.

[0106] Programming boot circuit: The BOOT pin (programming boot pin) is connected to a 10kΩ pull-down resistor, and the other end of the pull-down resistor is grounded to ensure that the BOOT pin is at a low level when the device is working normally, avoiding accidental triggering of the programming mode; the EN pin has a reserved test point (TP_RESE) for easy detection of the pin level during programming; during programming, the BOOT pin is triggered to a high level and the EN pin is reset by an external device, which can enter the programming mode and program, AI model weights, TTS voice segments and other data are programmed to the Flash storage module.

[0107] All VDD power pins of the chip (including VDD_S, 3V3, etc.) are fitted with 100nF ceramic decoupling capacitors in 0402 packages. One end of the capacitor is connected to the power pin, and the other end is grounded. This is used to filter out high-frequency noise from the power pins and stabilize the power supply voltage. An additional 10uF tantalum capacitor is added to the power input terminal. Tantalum capacitors have the characteristics of large capacitance and good stability. They can filter out power ripple and avoid power fluctuations from interfering with the chip and other modules, ensuring stable operation of the device.

[0108] like Figure 4As shown, the voice acquisition circuit uses a digital silicon microphone (model SGM3770 optional), which is directly connected to the I2S_CLK, I2S_WS, and I2S_DIN pins of the ESP32 via the I2S interface to achieve digital acquisition of voice signals. Compared with analog microphones, digital silicon microphones have the advantages of high acquisition accuracy, strong anti-interference ability, and no need for additional ADC conversion. A 1kΩ current-limiting resistor and an RC filter circuit (100nF ceramic capacitor + 1kΩ resistor) are connected in series to the silicon microphone power supply pins. The current-limiting resistor limits the silicon microphone's operating current, and the RC filter circuit filters out noise in the power supply to avoid affecting the voice acquisition quality. During layout, ventilation holes are reserved at the silicon microphone location to ensure smooth voice transmission, while strictly adhering to the layout principle of keeping it away from RF and power traces to avoid electromagnetic interference. The dual-microphone array can be expanded as needed for differential noise reduction. The specific implementation is as follows: After expansion, the dual-microphone array is still located in an independent area on the left side of the circuit board. Two digital silicon microphones (both model SGM3770) are symmetrically distributed on both sides of the ventilation hole, with a spacing of 20mm (to adapt to the miniaturized size of the badge while ensuring the differential noise reduction effect). The I2S (Inter-IC Sound) interfaces of the two silicon microphones are respectively connected to the two sets of I2S interface pins of the ESP32 main controller to form a dual-channel voice acquisition channel. An RC (resistor-capacitor) filter circuit can also be added to each of the signal transmission paths of the dual-microphone array to further filter out noise in the single-channel acquisition signal. At the software level, the voice signals acquired by the dual channels are processed through a differential noise reduction algorithm. The core of the algorithm is to extract the same source voice signal (user's voice) acquired by the two silicon microphones, suppress the same environmental noise (such as external conversations and environmental noise) in the two signals, and retain and enhance the same source voice signal. Specifically, after synchronous sampling and gain calibration of the dual-channel voice signals, the difference between the two signals is calculated. Noise signals with small differences are filtered out, while voice signals with large differences are amplified. After noise reduction processing, the signal-to-noise ratio of the voice acquisition can be improved to over 70dB. Compared to single-microphone acquisition, the environmental noise suppression effect is improved by 40%, ensuring clear acquisition of user voice even in noisy environments and guaranteeing the accuracy of subsequent ASR recognition. Through the aforementioned layout design of physically isolating the digital silicon microphone from RF and power traces on the circuit board and setting a dedicated ground isolation strip, the impact of high-frequency electromagnetic interference and power ripple on the clarity of voice acquisition is effectively suppressed at the physical level. This is the hardware foundation for achieving high-accuracy local ASR (speech recognition), ensuring accurate input text throughout the subsequent streaming inference process, and is an integral part of improving the final smoothness of the interaction.

[0109] The audio output circuit primarily uses a Class D power amplifier chip (model ES8311 optional). This chip has an efficiency of ≥90%, making it suitable for low-power scenarios. It can output high power under low supply voltage, adapting to the lithium battery power supply requirements of this invention. The input pin of the power amplifier chip is connected to the DAC (digital-to-analog converter) pin of the ESP32, receiving the digital audio signal output from the main control module and converting it into an analog audio signal through the chip's internal PWM module. A 10uF electrolytic filter capacitor is connected in series at the output end to filter out high-frequency noise, preventing popping sounds during power-on and improving audio output quality. A 4Ω / 3W speaker is connected at the output end to match the output power of the power amplifier chip, ensuring clear and loud voice output. A 10kΩ adjustable potentiometer can be added as needed, connected to the gain adjustment pin of the power amplifier chip, to achieve manual volume adjustment and meet the needs of different users.

[0110] The display module circuit uses a 1.75-inch TFT LCD (Thin Film Transistor Liquid Crystal Display) screen, which is connected to the ESP32 master controller via an SPI interface. The screen resolution is 466. The 466 supports displaying color images, text, and emoticons. The CS, SCL, SDA, DC, and RST pins of the screen are connected to the GPIO (General Purpose Input / Output) pins of the ESP32 microcontroller, and the main control module controls the screen's display content. The screen power supply pin is connected to a 3.3V power supply, and the ground pin is reliably grounded. The screen is used to synchronously display the emoticons and text replies of the current anime character, achieving dual "voice + visual" interaction and enhancing the user experience. The screen brightness can be adjusted via the main control module to adapt to different usage scenarios.

[0111] like Figure 5 As shown, the storage module circuit uses a 16MB Flash memory chip (model W25Q128JV optional), connected to the ESP32 main controller via an SPI interface. It stores program code, AI model weights, anime character design data (including personality traits, tone of voice, catchphrases, and facial expressions), pre-recorded TTS voice segments, wake-up word models, and other data. The CS, SCK, MOSI, and MISO pins of the Flash chip are connected to the corresponding SPI interface pins of the ESP32, with the main control module controlling data reading and writing. The Flash chip supports high-speed reading, meeting the requirements of rapid model weight reading in the streaming weight loading mechanism and ensuring the smoothness of AI inference.

[0112] Power module circuit: Powered by a 3.7V lithium battery, equipped with a lithium battery charging management chip (TP4056 optional), supporting 5V Universal Serial Bus (USB) charging. The indicator light illuminates during charging and turns off when fully charged. The lithium battery output voltage is converted to a stable 3.3V voltage by an LDO regulator chip (NS4150B optional) to power the entire device. The power module includes a fuse and a reverse connection protection diode. The fuse prevents damage to the device due to excessive current, and the reverse connection protection diode prevents the device from burning out due to reversed battery polarity. The power module supports a low-power mode, automatically reducing the supply current to extend battery life when the device is in standby mode.

[0113] Button module circuit: Includes BOOT programming button and reset button, both of which are tactile buttons. For example... Figure 6 As shown, one end of the BOOT button is connected to the BOOT pin (G0) of the ESP32, and the other end is grounded; one end of the reset button is connected to the EN pin of the ESP32, and the other end is grounded; each button is connected in parallel with a 100nF debouncing capacitor to eliminate level jitter when the button is pressed and ensure the stability of the button signal; in addition, a character switching button can be added as needed, with one end connected to the GPIO pin of the ESP32 and the other end grounded, for users to manually switch between anime characters and improve the convenience of interaction.

[0114] Figure 7 A structural diagram of the inference computing device for another AI interactive toy provided in this application embodiment is shown below. Figure 7 As shown, the reasoning and computing device of the AI ​​interactive toy includes: a memory 20 for storing computer programs; The processor 21 is used to execute a computer program to implement the steps of the method for obtaining user operation habit information as described in the above embodiment (control method for AI interactive toys).

[0115] The inference computing device for the AI ​​interactive toy provided in this embodiment may include, but is not limited to, mobile terminals, personal computers, workstations, etc.

[0116] The processor 21 may include one or more processing cores, such as a quad-core processor or an octa-core processor. The processor 21 may be implemented using at least one of the following hardware forms: Digital Signal Processor (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 21 may also include a main processor and a coprocessor. The main processor, also known as the Central Processing Unit (CPU), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 21 may integrate a Graphics Processing Unit (GPU), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, the processor 21 may also include an Artificial Intelligence (AI) processor, which handles computational operations related to machine learning.

[0117] The memory 20 may include one or more computer-readable storage media, which may be non-transitory. The memory 20 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In this embodiment, the memory 20 is used to store at least the following computer program 201, which, after being loaded and executed by the processor 21, is capable of implementing the relevant steps of the AI ​​interactive toy control method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 20 may also include an operating system 202 and data 203, and the storage method may be temporary or permanent storage. The operating system 202 may include Windows, Unix, Linux, etc. The data 203 may include, but is not limited to, data involved in implementing the AI ​​interactive toy control method.

[0118] In some embodiments, the reasoning and computing device of the AI ​​interactive toy may further include a display screen 22, an input / output interface 23, a communication interface 24, a power supply 25, and a communication bus 26.

[0119] Those skilled in the art will understand that Figure 7 The structure shown does not constitute a limitation on the reasoning computing device of the AI ​​interactive toy, and may include more or fewer components than shown.

[0120] The inference computing device for AI interactive toys provided in this application includes a memory and a processor. When the processor executes the program stored in the memory, it can implement the following method: a control method for AI interactive toys.

[0121] Finally, this application also provides an embodiment corresponding to a computer-readable storage medium. The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps described in the above embodiment of the control method for the AI ​​interactive toy.

[0122] It is understood that if the methods in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and executes all or part of the steps of the methods in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0123] The computer-readable storage medium provided in this embodiment stores a computer program thereon. When the processor executes the program, it can implement the following method: a control method for AI interactive toys.

[0124] The control method for AI interactive toys, as well as the AI ​​interactive toys, media, and devices provided in this application, have been described in detail above. The various embodiments in the specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple; relevant parts can be referred to in the method section. It should be noted that those skilled in the art can make several improvements and modifications to this application without departing from the principles of this application, and these improvements and modifications also fall within the protection scope of this application.

[0125] It should also be noted that, in this specification, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes the element.

Claims

1. A control method for an AI interactive toy, characterized in that, include: Two storage areas are divided in the running memory: a weight buffer and a tensor working area. Based on the pre-established hierarchical inference index table, the weight data block corresponding to the current computing layer of the target AI interactive model is streamed from non-volatile memory to the weight buffer via direct memory access. Specifically, the weight data of the target AI interactive model is split into multiple independent weight data blocks according to the model structure layer and stored in non-volatile memory respectively. The hierarchical inference index table is established in the running memory based on the storage address and metadata of each weight data block. Obtain the input tensor to be processed and store the input tensor in the tensor working area; wherein the input tensor to be processed is obtained according to the wake-up signal encoding; The current layer weight data in the weight buffer is called, and a preset neural network layer operation is performed on the current input tensor in the tensor working area to generate an output tensor. The output tensor is then used to overwrite the tensor working area as the input tensor for the next layer. After the current layer calculation is completed, the weight buffer is marked as overwriteable, and the process returns to the step of streaming the weight data block corresponding to the current calculation layer of the target AI interactive model from non-volatile memory to the weight buffer via direct memory access to overwrite the weight buffer, until the processing of all network layers is completed. The final output tensor obtained after processing all layers is decoded to generate and output the response information.

2. The control method for the AI ​​interactive toy according to claim 1, characterized in that, Based on the weight data of the target AI interactive model, it is split into multiple independent weight data blocks according to the model structure layer, and stored in non-volatile memory respectively. Based on the storage address and metadata of each weight data block, a hierarchical inference index table is established in runtime memory, including: An independent storage directory is established in the non-volatile memory for each preset character AI interactive model; The weight data of each network layer of the AI ​​interactive model for each preset character is encapsulated into independent, directly addressable binary weight data blocks, and a configuration file is generated. The configuration file records at least the total number of layers of the model, the physical starting address of each weight data block in the non-volatile memory, the data length, and the calculation order. During device initialization, the configuration file is parsed, and the physical starting address, data length, and corresponding tensor dimension of each layer's weight data block are mapped into an ordered array and stored in the running memory as the layer inference index table.

3. The control method for the AI ​​interactive toy according to claim 2, characterized in that, The storage space of the weight buffer is not less than the size of the largest weight data block; Correspondingly, the weight data block corresponding to the current computation layer of the target AI interactive model is streamed from non-volatile memory to the weight buffer via direct memory access, including: Query the hierarchical inference index table to obtain the physical starting address and data length of the weight data block corresponding to the current layer; Without consuming central processing unit resources, a direct memory access request is initiated, controlling the non-volatile memory to directly transmit the weight data block to the weight buffer in the form of a data stream.

4. The control method for the AI ​​interactive toy according to claim 3, characterized in that, Initiating a direct memory access request also includes: While the direct memory access transmits the weight data block of the current layer, preset neural network layer operations are performed on the loaded weight data block of the previous layer and / or the input tensor.

5. The control method for the AI ​​interactive toy according to claim 2, characterized in that, The process involves calling the current layer weight data in the weight buffer, performing a preset neural network layer operation on the current input tensor in the tensor working area, generating an output tensor, and using this output tensor to overwrite the tensor working area as the input tensor for the next layer, including: Map the current layer weight data in the weight buffer to a weight tensor; Read the current input tensor in the tensor working area, perform matrix multiplication and activation function operation with the weight tensor to obtain the output tensor of the current layer; The output tensor of the current layer is overwritten and written to the storage location of the input tensor in the tensor working area to update the data state of the tensor working area, which is then used as the input tensor for the next computation layer.

6. The control method for the AI ​​interactive toy according to claim 5, characterized in that, The output tensor of the current layer is written to the storage location of the input tensor in the tensor working area to update the data state of the tensor working area, and then used as the input tensor for the next computation layer, including: If it is determined that the input tensor is no longer used by any model structure layer after the current layer, the output tensor of the current layer is overwritten into the storage location of the input tensor in the tensor working area to update the data state of the tensor working area, which will then serve as the input tensor for the next computation layer.

7. The control method for the AI ​​interactive toy according to claim 2, characterized in that, Also includes: In response to the received character switching command, determine the target character; Read the configuration file corresponding to the target persona from the non-volatile memory, and refresh the hierarchical reasoning index table in the running memory according to the configuration file corresponding to the target persona; Under the scheduling of the refreshed hierarchical inference index table, the step of streaming the weight data block corresponding to the current computing layer of the target AI interactive model from non-volatile memory to the weight buffer via direct memory access, based on the pre-established hierarchical inference index table.

8. The control method for the AI ​​interactive toy according to claim 7, characterized in that, The final output tensor obtained after processing all layers is decoded to generate and output the response information, including: The final output tensor is decoded to obtain the response text; Based on a pre-set library of voice segments corresponding to the current target persona, the reply text is converted into a voice signal, or the reply text is converted into a voice signal in real time through a text-to-speech module; The audio signal is played through a speaker driven by an audio power amplifier.

9. The control method for the AI ​​interactive toy according to claim 8, characterized in that, Also includes: While outputting the voice signal, the facial expression image of the target persona corresponding to the reply text is acquired; The emoticon image and / or the reply text are displayed synchronously on the display screen.

10. An AI interactive toy, characterized in that, include: The main control module includes running memory and a storage interface; A non-volatile memory, connected to the main control module, is used to store weight data blocks of multiple AI interactive models according to the model structure layer; A voice acquisition module, connected to the main control module, is used to acquire user voice signals; A voice output module, connected to the main control module, is used to output voice signals; The display module, connected to the main control module, is used to display images and / or text; The main control module is used to execute the control method of the AI ​​interactive toy as described in any one of claims 1 to 9.

11. The AI ​​interactive toy according to claim 10, characterized in that, The voice acquisition module includes a digital microphone, which is connected to the main control module via an I2S digital audio bus interface.

12. The AI ​​interactive toy according to claim 10, characterized in that, The non-volatile memory is an external Flash memory, which is connected to the main control module via an SPI interface.

13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the control method for the AI ​​interactive toy as described in any one of claims 1 to 9.

14. A reasoning and calculation device for an AI interactive toy, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the steps of the control method for the AI ​​interactive toy as described in any one of claims 1 to 9.