Large model construction method, device and equipment for local game and large model
By integrating large language models into local games and generating models suitable for low-end hardware through adaptive encoding and fine-tuning, the problem of high-performance computing equipment required for operation of large language models in the prior art is solved, and efficient game logic reasoning is achieved on low-end hardware.
Patent Information
- Application Number
- CN202510428922.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-08
- Publication Date
- 2025-05-06
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing large language models require high-performance computing equipment when running in games, making it difficult for online server solutions to cope with high-frequency user access and respond to queueing problems.
Provide a method to integrate large models into local games. By obtaining the large model framework for local games, converting them into binary files, and coding the game adaptation, fine-tuning it with inference results until the preset result is reached or the set threshold is reached, and a second large model file suitable for low-end hardware is generated.
It realizes that using big models to perform game logical reasoning without relying on the server, adapts to particularly low-end hardware reasoning performance, and avoids the problem of server response queuing.
Smart Images

Figure CN119925939A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of large game models, and in particular to a large model construction method, device, equipment and large model for local games. Background Art
[0002] In recent years, with the rapid development of artificial intelligence technology, the application of large language models (LLM) in games has gradually become a research hotspot. The game language large model embedding solution system aims to enhance the interactive experience of non-player characters in the game by embedding advanced language models, making it more intelligent and realistic.
[0003] Currently, the LLM large language model mainly relies on PyTorch for training and operation, and the operation requires high-performance computing equipment. The way of running games on online servers is difficult to cope with the increase in game users. Given the high frequency of game users, the server solution is bound to have the problem of response queuing. Summary of the invention
[0004] Based on this, it is necessary to provide a method, device, equipment and big model for local games that can integrate big models into local games, realize game logic reasoning using big models without relying on servers, and make the big models adapt to particularly low-end hardware reasoning performance.
[0005] In a first aspect, the present application provides a method for constructing a large model for a local game, the method comprising: Obtain a large model framework adapted for the local game, and convert the large model framework into a binary file; Acquire a data set of a local game, perform game adaptation encoding on the binary file, and obtain a first large model file; Repeatedly obtain the inference result outputted after the first large model file is called by the local game, and fine-tune the first large model file according to the inference result, until the inference result outputted after the first large model file is called by the local game meets the preset result or the number of fine-tuning reaches a set threshold, so as to obtain the second large model file.
[0006] In one embodiment, the first large model file includes a code module corresponding to each training layer of the large model framework, and the fine-tuning of the first large model file according to the inference result until the inference result output by the first large model file after being called by the local game meets the preset result or the number of fine-tuning reaches a set threshold includes: Obtaining a first parameter freezing range preset in a code module corresponding to each of the training layers; Based on the first parameter freezing range of each of the code modules, obtaining a first result output after the first large model file is called by the local game; According to the first result, dynamically fine-tune the first parameter freezing range of each of the code modules to obtain the second parameter freezing range of each of the code modules; Based on the second parameter freezing range of each of the code modules, obtaining a second result output after the first large model file is called by the local game; If the second result meets the preset result or the number of fine-tuning reaches the set threshold, the second large model file is obtained; otherwise, the second parameter freezing range of each code module is fine-tuned to obtain the third parameter freezing range of each code module, until the inference result output by the first large model file after being called by the local game meets the preset result or the number of fine-tuning reaches the set threshold.
[0007] In one embodiment, the binary file includes a code module corresponding to each training layer of the large model framework, the training layer includes at least one key layer and at least one basic layer, and the acquisition of a data set of a local game, game adaptation encoding of the binary file, and obtaining the first large model file include: Inserting a pseudo quantization node into at least one code module corresponding to the key layer and / or at least one code module corresponding to the base layer; Using perceptual quantization training, the binary file is quantized with mixed precision and each pseudo-quantization node is minimized to obtain a quantized binary file; Obtain the local game data set, perform game adaptation encoding on the quantized binary file, and obtain the first large model file.
[0008] In one embodiment, the first large model file includes a high-precision key layer code and a low-precision base layer code, and the mixed-precision quantization of the binary file includes: Obtaining a first weight value and a first activation value of a code module corresponding to each of the key layers, and performing floating point encoding on the first weight value and the first activation value to obtain the high-precision key layer code; The second weight value and the second activation value of the code template corresponding to each of the base layers are obtained, and the second weight value and the second activation value are integer-encoded to obtain the low-precision base layer code.
[0009] In one embodiment, the first large model file includes a code module corresponding to each training layer of the large model framework, the code module includes game data parameters of the local game and training data parameters of the large model framework, and the method further includes: The game data parameters and the training data parameters are subjected to data replacement, data encryption, and random noise addition to obtain an encrypted first large model file.
[0010] In one embodiment, the method further comprises: The second large model file is compiled into a dynamic link library, wherein the local game calls the dynamic link library through an API interface based on user instructions to implement the second large model file call.
[0011] In a second aspect, the present application also provides a large model construction device for local games, the device comprising: A large model conversion module, used to obtain a large model framework adapted for the local game and convert the large model framework into a binary file; A large model encoding module, used to obtain a data set of a local game, perform game adaptation encoding on the binary file, and obtain a first large model file; The large model training module is used to repeatedly obtain the inference results output by the first large model file after being called by the local game, and fine-tune the first large model file according to the inference results, until the inference results output by the first large model file after being called by the local game meet the preset results or the number of fine-tuning reaches a set threshold, thereby obtaining a second large model file.
[0012] In a third aspect, the present application further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the contents described in the first aspect when executing the computer program.
[0013] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the contents described in the first aspect above.
[0014] In a fifth aspect, the present application further provides a large model for local games, wherein the large model is constructed based on the large model construction method for local games as described in any one of the first aspects.
[0015] The above-mentioned large model construction method, device, equipment and large model for local games, by obtaining a large model framework adapted to the local game and converting the large model framework into a binary file; obtaining a data set of the local game, encoding the binary file for game adaptation, and obtaining a first large model file; repeatedly obtaining the inference result output by the first large model file after being called by the local game, and fine-tuning the first large model file according to the inference result, until the inference result output by the first large model file after being called by the local game meets the preset result or the number of fine-tuning reaches a set threshold, to obtain a second large model file, thereby realizing large model game logic coupling and game reasoning based on low-end terminal hardware, and the obtained large model can bypass the server to implement the call. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0017] Figure 1 A diagram of an application environment of a method for building a large model for a local game in one embodiment; Figure 2 A schematic flow chart of a method for building a large model for a local game in one embodiment; Figure 3 A schematic diagram of a flow chart of a fine-tuning step in an embodiment; Figure 4 is a schematic flow chart of a quantification step in an embodiment; Figure 5 A structural block diagram of a large model building device for local games in one embodiment; Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0018] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0019] Unless otherwise defined, the technical terms or scientific terms involved in this application should be understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the" and the like involved in this application do not indicate a quantity limitation, and may indicate the singular or plural. The terms "include", "comprise", "have" and any of their variations involved in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units that are not listed, or may also include other steps or units inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there may be three relationships, for example, "A and / or B" can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects before and after are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.
[0020] The large model construction method for local games provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown, the terminal 102 communicates with the server 104 through a network. The data storage system can store data that the server 104 needs to process. The data storage system can be integrated on the server 104, or placed on the cloud or other network servers.
[0021] On the terminal 102, a large model framework adapted for the local game is obtained, and the large model framework is converted into a binary file; a data set of the local game is obtained, and the binary file is encoded for game adaptation to obtain a first large model file; the inference result output by the first large model file after being called by the local game is repeatedly obtained, and the first large model file is fine-tuned according to the inference result, until the inference result output by the first large model file after being called by the local game meets the preset result or the number of fine-tuning reaches a set threshold, thereby obtaining a second large model file.
[0022] The terminal 102 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, etc. The server 104 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.
[0023] In an exemplary embodiment, Figure 2 As shown, a large model construction method for local games is provided, and the method is applied to Figure 1 The terminal in is taken as an example to illustrate, including the following steps 201 to 203. Among them: Step 201, obtain a large model framework adapted for the local game, and convert the large model framework into a binary file.
[0024] Specifically, a large model framework adapted for the local game is obtained on the terminal, and the large model framework is converted into a binary file that can be called by a cross-platform programming language, wherein the cross-platform programming language includes the C programming language, the C++ programming language, and the JAVA programming language. The binary file includes a code module corresponding to each training layer of the large model framework.
[0025] Step 202, obtain the data set of the local game, perform game adaptation encoding on the binary file, and obtain the first large model file.
[0026] Among them, the data set of the local game includes game background, game characters, character status, combat strategy, character behavior, etc. According to the different data contained in the data set, the binary file converted by the large model is encoded for game adaptation through the C++ programming language, including the text data extraction, word segmentation, text embedding, encoding, attention mechanism operation process, decoding process and reasoning result generation process of the large model, and the first large model file is obtained. Among them, the first large model file is a pre-trained large model of the local game, and the local game, i.e., the terminal, can directly call and train the first large model file without going through the server.
[0027] Step 203, repeatedly obtain the inference result outputted after the first large model file is called by the local game, and fine-tune the first large model file according to the inference result, until the inference result outputted after the first large model file is called by the local game meets the preset result or the number of fine-tuning reaches a set threshold, thereby obtaining the second large model file.
[0028] Specifically, the first large model file is compiled into a dynamic link library so that the first large model file can be deployed on the terminal, and the local game calls the dynamic link library through the API interface based on user instructions to implement the call training of the first large model file. Repeatedly obtain the inference results output by the first large model file after being called by the local game, and calculate the accuracy, recall rate and F1 score of the large model based on the error between the inference result and the preset result to evaluate the inference performance of the large model for specific tasks, and use the code to fine-tune the first large model file until the inference result output by the first large model file after being called by the local game meets the preset result or the number of fine-tuning reaches the set threshold, and obtain the second large model file, wherein the second large model file is a fully trained large model adapted for the local game, and the second large model file at this time can adapt to specific game environments and needs, and has strong generalization capabilities.
[0029] In the above method, a large model framework adapted for the local game is obtained and converted into a binary file; a data set of the local game is obtained, and the binary file is encoded for game adaptation to obtain a first large model file; the inference result output by the first large model file after being called by the local game is repeatedly obtained, and the first large model file is fine-tuned according to the inference result, until the inference result output by the first large model file after being called by the local game meets the preset result or the number of fine-tuning reaches a set threshold, a second large model file that can be called by the local game without going through the server is constructed, and game logic coupling and game reasoning based on low-end terminal hardware are realized.
[0030] In an exemplary embodiment, Figure 3 As shown, in step 203, the first large model file is fine-tuned according to the inference result until the inference result outputted after the first large model file is called by the local game meets the preset result or the number of fine-tuning reaches a set threshold, specifically including the following steps 301 to 305.
[0031] Among them, the first large model file includes a code module corresponding to each training layer of the large model framework.
[0032] Step 301: Obtain a first parameter freezing range preset in a code module corresponding to each of the training layers.
[0033] Step 302: Based on the first parameter freezing range of each of the code modules, obtain the first result output after the first large model file is called by the local game.
[0034] Step 303: dynamically fine-tune the first parameter freezing range of each of the code modules according to the first result to obtain the second parameter freezing range of each of the code modules.
[0035] Step 304: Based on the second parameter freezing range of each of the code modules, obtain the second result output after the first large model file is called by the local game.
[0036] Step 305: If the second result meets the preset result or the number of fine-tuning reaches the set threshold, the second large model file is obtained; otherwise, the second parameter freezing range of each of the code modules is fine-tuned to obtain the third parameter freezing range of each of the code modules, until the inference result outputted by the first large model file after being called by the local game meets the preset result or the number of fine-tuning reaches the set threshold.
[0037] In detail, during the model training process, each time the user inputs a code instruction to the local game, and the local game calls the first large model file for inference training according to the code instruction, the training layer parameters of the first large model file are frozen to retain the general model knowledge of the first large model file, and with the progress of each training process, the parameter freezing range of each training layer is dynamically adjusted in layers to enable the first large model file to achieve the best performance output balance, realize fine-tuning of the first large model file, and improve the task reasoning accuracy of the large model file that is finally trained.
[0038] Preferably, the fine-tuning of the first large model file also includes: writing an automated loss function adapter, the automated loss function adapter includes at least one loss function, wherein the loss function includes a first loss function, a second loss function and a third loss function. The first loss function is used to calculate the average of the squares of the differences between the multiple inference results obtained by continuous prediction of the first large model file and the preset results, that is, the first loss value. The second loss function is used to calculate the second loss value when the first large model file performs a classification problem. The third loss function is used to calculate the third loss value when the first large model file performs a task that is insensitive to outliers. The automated loss function adapter automatically converts the adapted loss function to calculate the loss value of the first large model file according to the code instructions input by the user training, so as to guide the first large model file to optimize the correct target. If the first loss value calculated by the first loss function is less than or equal to the first set threshold and / or the second loss value calculated by the second loss function is less than or equal to the second set threshold and / or the third loss value calculated by the third loss function is less than or equal to the third set threshold, then the trained first large model file meets the needs of the local game.
[0039] Furthermore, the fine-tuning of the first large model file also includes: in the process of model training, applying regularization technology to prevent overfitting of model training and enhance the generalization ability of the model. In detail, the regularization technology includes introducing weight decay in the loss function, by adding a penalty term proportional to the square of the weight of the code module in the loss function. Specifically, if there is a loss function Loss_original and a regularization parameter λ, then the new loss function Loss after adding the penalty term can be expressed as Loss=Loss_original+λ∑wW2. In detail, the regularization technology also includes setting random loss values, that is, in each training iteration, the outputs of certain neurons are randomly set to zero with a certain probability (such as 0.5), so that these neurons do not participate in forward propagation and back propagation in this iteration. During training and testing, all neurons remain active, but the output values need to be scaled according to the probability during training to maintain the consistency of the expected output.
[0040] In one of the embodiments, the training layer includes at least one embedding layer. When the binary file is encoded for game adaptation in step 202, additional anthropomorphic behavior code modules and emotional processing code modules are embedded in the embedding layer to achieve reasoning and prediction of character behavior in the game.
[0041] In an exemplary embodiment, the binary file includes a code module corresponding to each training layer of the large model framework, and the training layer includes at least one key layer and at least one basic layer. Figure 4 As shown, step 202 obtains the data set of the local game, performs game adaptation encoding on the binary file, and obtains the first large model file, which specifically includes the following steps 401 to 403.
[0042] Step 401: insert a pseudo quantization node into a code module corresponding to at least one of the key layers and / or a code module corresponding to at least one of the base layers.
[0043] Step 402 , using perceptual quantization training, performs mixed precision quantization on the binary file and minimizes each of the pseudo quantization nodes to obtain a quantized binary file.
[0044] Step 403, obtain the data set of the local game, perform game adaptation encoding on the quantized binary file, and obtain the first large model file.
[0045] In detail, in order to reduce the size of the first model file and improve the reasoning speed, the binary file needs to be quantized. Therefore, before the binary file is encoded for game adaptation, a pseudo-quantization node is inserted into the code module corresponding to at least one of the key layers and / or at least one of the base layers to simulate the quantization error. The binary file is quantized with mixed precision and each pseudo-quantization node is minimized using perceptual quantization training to obtain a quantized binary file. The data set of the local game is obtained, and the quantized binary file is encoded for game adaptation to obtain the first large model file. At this time, the first large model file optimizes the model storage and operation efficiency and reduces the hardware requirements.
[0046] In a preferred embodiment, the mixed precision quantization of the binary file in step 402 includes: obtaining the first weight value and the first activation value of the code module corresponding to each of the key layers, and performing floating point encoding on the first weight value and the first activation value to obtain the high-precision key layer code; obtaining the second weight value and the second activation value of the code template corresponding to each of the base layers, and performing integer encoding on the second weight value and the second activation value to obtain the low-precision base layer code.
[0047] The key layers include at least one of the following: a starting layer, an ending layer, an attention layer, a convolution and pooling layer, etc. The high-precision key layer code is obtained by performing floating-point encoding on the first weight value and the first activation value of the code module of these key layers, and the low-precision base layer code is obtained by performing integer encoding on the second weight value and the second activation value of the code module of the base layer, so as to balance the performance and efficiency of the model.
[0048] Furthermore, the training layer also includes a fully connected layer and an activation function layer. During the model training process, when the error propagation of the first large model file is matched with the subsequent fully connected layer and activation function layer, error feedback is used to take the output of the quantized first large model file as the input of the preset compensation network model, and the compensation network model reduces the influence of the accumulated error on the output reasoning result during the training of the first large model file, thereby solving the gradient decoupling problem during the training of the first large model file.
[0049] In an exemplary embodiment, the first large model file includes a code module corresponding to each training layer of the large model framework, the code module includes game data parameters of the local game and training data parameters of the large model framework, and the method further includes: The game data parameters and the training data parameters are subjected to data replacement, data encryption, and random noise addition to obtain an encrypted first large model file.
[0050] In detail, in order to ensure the data security of the first large model file and the local game during the training process, at least one data processing method such as data replacement, data encryption, and adding random noise is used for the game data parameters and training data parameters, which not only can achieve security review of the data, but also ensure that the data does not contain harmful information.
[0051] More preferably, through red team testing, the continuous confrontation process between the defender and the attacker and the jailbreak attack method are used to detect the security vulnerabilities of the model, and machine learning and deep learning risk identification technology are used as automated discriminators to monitor the model reasoning process, prevent potential security threats, ensure the security of the game environment, and prevent the reasoning results from outputting non-compliant content.
[0052] In an exemplary embodiment, the method further includes: compiling the second large model file into a dynamic link library, wherein the local game calls the dynamic link library through an API interface based on user instructions to implement the second large model file call.
[0053] In this embodiment, by compiling the second largest model file, which is a large and well-trained model adapted to the local game, into a dynamic link library, the performance advantages of C++ programming can be fully utilized to implement memory management and direct system calls of local games, reduce the interpretation overhead when the model is running, and improve execution efficiency. In addition, in the form of a dynamic link library, it can be more closely integrated with the game logic to achieve seamless interaction and data exchange, and can also better control the access rights and usage environment of the model, enhance security, reduce network transmission through local calls, reduce the risk of data leakage, and facilitate monitoring and auditing the use of the model.
[0054] In an exemplary embodiment, in addition to training the first large model file to implement the reasoning process of the local game, it also includes: obtaining anti-jailbreak corpus, training the first large model file to identify the jailbreak behavior of the terminal, and obtaining the third large model file. In addition to being able to adapt to specific game environments and requirements, the third large model file also has anti-jailbreak recognition capabilities.
[0055] In detail, by collating anti-jailbreak corpus, we collect various prompts from user requests and combine malicious prompts to create more complex and hidden harmful intentions. Such prompts conceal their malicious intentions through role-playing, scenario assumptions, long context prompts and adaptive strategies. They are usually difficult to identify and need to be written into corresponding feedback corpus templates to train the model to identify jailbreak behavior while maintaining the original capabilities of the model. When training the first large model file to identify and adjust parameters, learn how to identify and defend against jailbreak attacks in constant interaction. Using reinforcement learning technology, dynamically adjust its internal parameters and response strategies to deal with different types of jailbreak attacks, and find a suitable loss value to balance anti-jailbreak capabilities and model performance.
[0056] For example, the jailbreak test data is written into the file under the private path. If it is successfully written, the program determines that the terminal may have been jailbroken. If it is determined that it may have been jailbroken, the MD5 code of the third largest model file under the model path is compared with the MD5 code of the sample model stored on the server. If they are different, the sample model is downloaded and replaced and the access rights of the / private path are repaired to achieve anti-jailbreak for local games.
[0057] Exemplarily, the environment variable detection function getenv is hooked to check the specified environment variable. If the specified environment variable is set, it means that a dynamic link library has been injected into the application, which can bypass the jailbreak detection by modifying the return value. Therefore, the command executed after the return value is modified is encoded, and the dynamic link library execution reasoning will not be enabled after the return value is modified, thereby enhancing the security of the game and preventing illegal modifications and jailbreaking.
[0058] In an exemplary embodiment, the method further includes: determining the quantization parameters of the second large model file through a calibration data set, and dynamically adjusting the quantization parameters of the second large model file to keep the data format consistent with that during training. The quantization error repair strategy is reduced by adjusting the numerical range of adjacent training layers in the second large model file to achieve optimal performance. The weight difference before and after quantization is analyzed by optimizing the mean square error between the original weight and the quantized weight of the second large model file and minimizing the entropy between the original value and the quantized value, and a correction parameter is generated to optimize the output of the training layer after quantization to make it closer to the data before quantization.
[0059] In this embodiment, the obtained second largest model file is repaired and enhanced to ensure its availability and ensure that the large model finally used has good stability.
[0060] Furthermore, repairing and strengthening the obtained second largest model file also includes: converting the global state of the inference results output by the second largest model file into a meaningful low-dimensional embedding vector by time step, guiding the intelligent agent in the local game to transition to a more ideal state, and designing a reward system, optimizing the flow and efficiency of the game logic, using the prefix instance statements of the in-game characters or system logic as memory prompts, strengthening the quantification of lost functional memory, and realizing the optimization of the game logic.
[0061] In a preferred embodiment, since the second large model file is a dynamic link library, when the user enters the local game at the terminal, a large model calling method for the local game is provided, which specifically includes the following contents: In response to the user's input content in the local game, determine whether there is a graphics card of preset specifications in the running device of the local game; if so, load the second largest model file into the graphics card memory of the running device through the API interface, perform local reasoning through the second largest model file, and output the reasoning result; if not, load the second largest model file into the memory of the running device through the API interface, perform local reasoning through the second largest model file, and output the reasoning result.
[0062] In this embodiment, the second largest model file obtained through the above embodiments can adapt to particularly low-end hardware inference performance, and can achieve better game logic coupling and security supervision without going through the server.
[0063] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0064] Based on the same inventive concept, the embodiment of the present application also provides a large model construction device for local games for implementing the large model construction method for local games involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in one or more embodiments of the large model construction device for local games provided below can refer to the limitations of the large model construction method for local games above, and will not be repeated here.
[0065] In an exemplary embodiment, Figure 5 As shown, a large model construction device for local games is provided, including: a large model conversion module 61, a large model encoding module 62 and a large model training module 63, wherein: The large model conversion module 61 is used to obtain a large model framework adapted for the local game and convert the large model framework into a binary file.
[0066] The large model encoding module 62 is used to obtain a data set of a local game, perform game adaptation encoding on the binary file, and obtain a first large model file.
[0067] The large model training module 63 is used to repeatedly obtain the inference results output by the first large model file after being called by the local game, and fine-tune the first large model file according to the inference results, until the inference results output by the first large model file after being called by the local game meet the preset results or the number of fine-tuning reaches a set threshold, thereby obtaining a second large model file.
[0068] In one embodiment, the first large model file includes a code module corresponding to each training layer of the large model framework, and the large model training module 63 is also used to: obtain a first parameter freezing range preset in the code module corresponding to each training layer; based on the first parameter freezing range of each code module, obtain a first result output by the first large model file after being called by the local game; according to the first result, dynamically fine-tune the first parameter freezing range of each code module to obtain a second parameter freezing range of each code module; based on the second parameter freezing range of each code module, obtain a second result output by the first large model file after being called by the local game; if the second result meets the preset result or the number of fine-tuning reaches the set threshold, the second large model file is obtained, otherwise, the second parameter freezing range of each code module is fine-tuned to obtain a third parameter freezing range of each code module, until the inference result output by the first large model file after being called by the local game meets the preset result or the number of fine-tuning reaches the set threshold.
[0069] In one embodiment, the binary file includes a code module corresponding to each training layer of the large model framework, the training layer includes at least one key layer and at least one base layer, and the large model encoding module 62 is further used to: In one embodiment, the large model encoding module 62 is also used to: insert a pseudo-quantization node into at least one code module corresponding to the key layer and / or at least one code module corresponding to the base layer; use perceptual quantization training to perform mixed precision quantization on the binary file and minimize each pseudo-quantization node to obtain a quantized binary file; obtain a data set of a local game, perform game adaptation encoding on the quantized binary file, and obtain a first large model file.
[0070] In one embodiment, the first large model file includes high-precision key layer code and low-precision base layer code, and the large model encoding module 62 is also used to: obtain the first weight value and the first activation value of the code module corresponding to each of the key layers, and perform floating-point encoding on the first weight value and the first activation value to obtain the high-precision key layer code; obtain the second weight value and the second activation value of the code template corresponding to each of the base layers, and perform integer encoding on the second weight value and the second activation value to obtain the low-precision base layer code.
[0071] In one embodiment, the first large model file includes a code module corresponding to each training layer of the large model framework, and the code module contains game data parameters of the local game and training data parameters of the large model framework. The large model encoding module 62 is also used to: replace data, encrypt data, and add random noise to the game data parameters and the training data parameters to obtain the encrypted first large model file.
[0072] In one embodiment, the large model encoding module 62 is further used to compile the second large model file into a dynamic link library, wherein the local game calls the dynamic link library through an API interface based on user instructions to implement the second large model file call.
[0073] Each module in the above-mentioned large model construction device for local games can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each of the above modules.
[0074] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 6As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a large model construction method for local games is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0075] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0076] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the steps corresponding to the method for constructing a large model for a local game as described in the above embodiments are implemented.
[0077] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps corresponding to the method for building a large model for local games as described in the above embodiments are implemented.
[0078] In one embodiment, a computer program product is provided, including a computer program, which, when executed by a processor, implements the steps corresponding to the method for building a large model for a local game as described in the above embodiments.
[0079] In one embodiment, a large model for a local game is provided, wherein the large model is obtained by executing the large model construction method for a local game described in the above embodiments by a computer device.
[0080] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0081] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0082] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A method for constructing a large model for a local game, characterized in that: The method comprises: Obtain a large model framework adapted for the local game, and convert the large model framework into a binary file; Acquire a data set of a local game, perform game adaptation encoding on the binary file, and obtain a first large model file; Repeatedly obtain the inference result outputted after the first large model file is called by the local game, and fine-tune the first large model file according to the inference result, until the inference result outputted after the first large model file is called by the local game meets the preset result or the number of fine-tuning reaches a set threshold, so as to obtain the second large model file.
2. The method for constructing a large model for a local game according to claim 1, characterized in that: The first large model file includes a code module corresponding to each training layer of the large model framework, and the fine-tuning of the first large model file according to the inference result until the inference result output by the first large model file after being called by the local game meets the preset result or the number of fine-tuning reaches a set threshold includes: Obtaining a first parameter freezing range preset in a code module corresponding to each of the training layers; Based on the first parameter freezing range of each of the code modules, obtaining a first result output after the first large model file is called by the local game; According to the first result, dynamically fine-tune the first parameter freezing range of each of the code modules to obtain the second parameter freezing range of each of the code modules; Based on the second parameter freezing range of each of the code modules, obtaining a second result output after the first large model file is called by the local game; If the second result meets the preset result or the number of fine-tuning reaches the set threshold, the second large model file is obtained; otherwise, the second parameter freezing range of each code module is fine-tuned to obtain the third parameter freezing range of each code module, until the inference result output by the first large model file after being called by the local game meets the preset result or the number of fine-tuning reaches the set threshold.
3. The method for constructing a large model for a local game according to claim 1, characterized in that: The binary file includes a code module corresponding to each training layer of the large model framework, the training layer includes at least one key layer and at least one basic layer, and the acquisition of a local game data set, game adaptation encoding of the binary file, and the acquisition of the first large model file include: Inserting a pseudo quantization node into at least one code module corresponding to the key layer and / or at least one code module corresponding to the base layer; Using perceptual quantization training, the binary file is quantized with mixed precision and each pseudo-quantization node is minimized to obtain a quantized binary file; Obtain the local game data set, perform game adaptation encoding on the quantized binary file, and obtain the first large model file.
4. The method for constructing a large model for a local game according to claim 3, characterized in that: The first large model file includes a high-precision key layer code and a low-precision base layer code, and the mixed-precision quantization of the binary file includes: Obtaining a first weight value and a first activation value of a code module corresponding to each of the key layers, and performing floating point encoding on the first weight value and the first activation value to obtain the high-precision key layer code; The second weight value and the second activation value of the code template corresponding to each of the base layers are obtained, and the second weight value and the second activation value are integer-encoded to obtain the low-precision base layer code.
5. The method for constructing a large model for a local game according to claim 1, characterized in that: The first large model file includes a code module corresponding to each training layer of the large model framework, the code module includes game data parameters of the local game and training data parameters of the large model framework, and the method further includes: The game data parameters and the training data parameters are subjected to data replacement, data encryption, and random noise addition to obtain an encrypted first large model file.
6. The method for constructing a large model for a local game according to claim 1, characterized in that: The method further comprises: The second large model file is compiled into a dynamic link library, wherein the local game calls the dynamic link library through an API interface based on user instructions to implement the second large model file call.
7. A large model building device for local games, characterized in that: The device comprises: A large model conversion module, used to obtain a large model framework adapted for the local game and convert the large model framework into a binary file; A large model encoding module, used to obtain a data set of a local game, perform game adaptation encoding on the binary file, and obtain a first large model file; The large model training module is used to repeatedly obtain the inference results output by the first large model file after being called by the local game, and fine-tune the first large model file according to the inference results, until the inference results output by the first large model file after being called by the local game meet the preset results or the number of fine-tuning reaches a set threshold, thereby obtaining a second large model file.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A large model for local games, characterized in that The large model is constructed based on the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Visual content generation method, device, system, equipment and medium
CN114880441A
Data processing method and device and storage medium
CN116450808A
State sensing method and device based on artificial intelligence Transform and storage medium
CN117494575A
Method, system and device for embedding large language model in game and medium
CN118798370A
Generative AI emotion propagation prediction and guidance large model construction method and system
CN119047512A