A warehouse management method, device, equipment and medium based on large language model
By building a large language model and accessing the warehousing database, natural language interaction is realized, which solves the scalability and integration problems of the existing warehousing and logistics management system, improves user experience and management efficiency, and reduces development costs.
Patent Information
- Application Number
- CN202410817209.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-24
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2044-06-24
AI Technical Summary
The existing warehousing and logistics management system lacks scalability and integration capabilities, and cannot interact with the system through natural language, resulting in low user interaction experience and high development costs.
By building a large language model and connecting it to the database, natural language is used to communicate with the system, automatically solving user needs and improving warehouse management efficiency and user experience.
It realizes natural language interaction without the need for a special operation interface, automatically handles warehouse management tasks, reduces development costs, and improves the scalability and integration capabilities of the system.
Smart Images

Figure CN118428858B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of large models, and in particular to a warehouse management method, device, equipment and medium based on a large language model. Background Art
[0002] Currently, the vast majority of warehouse logistics management system solutions in the industry rely on requirements from the demand side (warehouse managers), with software developers adding functionality to the system to meet those needs. However, this approach lacks scalability for warehouse management, limiting functionality to manual configuration and preventing integration with other systems (such as finance and customer service).
[0003] Recent AI-based warehouse logistics management methods rely solely on large models for processing logistics data. They are unable to process natural human language, and therefore cannot achieve human-system interaction. Therefore, improving the user experience during warehouse management remains an unresolved challenge in this field. Summary of the Invention
[0004] In view of this, the purpose of the present invention is to provide a warehouse management method, device, equipment, and storage medium based on a large language model. By constructing a large language model and accessing a database, no dedicated operation interface is required. Relevant personnel can communicate with the system using natural language. The warehouse system can automatically solve user-related needs, thereby improving the efficiency of warehouse management and the user experience. The specific solution is as follows:
[0005] In a first aspect, the present application provides a warehouse management method based on a large language model, comprising:
[0006] Creating a warehousing database based on preset warehouse information and preset cargo information; the initial state of the warehousing database is empty;
[0007] Constructing an initial large language model, and training the initial large language model based on a preset corpus to obtain a target large language model;
[0008] An operation code for the warehousing database is generated based on a preset code generation method, and the target large language model is connected to the warehousing database, so as to perform warehousing management on the warehousing database using the operation code based on the target large language model.
[0009] Optionally, the operation code is a code constructed based on structured query language.
[0010] Optionally, generating the operation code of the warehouse database based on a preset code generation method includes:
[0011] Building an initial code generation model based on the target large language module;
[0012] Obtaining a target code pair input by a user, and training the initial code generation model based on the target code pair, so as to generate a corresponding operation code based on the user instruction according to the obtained target code model;
[0013] The target code pair includes a code input by the user and a corresponding action.
[0014] Optionally, constructing an initial code generation model based on the target large language module includes:
[0015] Adding a code encoder, a code decoder, and a dimensionality reduction layer to the hidden layer of the target large language model;
[0016] Accordingly, the step of obtaining the target code pair input by the user and training the initial code generation model based on the target code pair includes:
[0017] Inputting the action of the target code pair into the target large language model to obtain features corresponding to the action, and reducing the features through the dimensionality reduction layer to obtain reduced-dimensionality features;
[0018] Inputting the code of the target code pair into the code encoder to obtain the code corresponding to the code;
[0019] Determine a first loss corresponding to the target code based on the dimensionality reduced features and the encoding;
[0020] Inputting the code into the code decoder to obtain a corresponding logit value, and determining a second loss between the logit value and the code based on a mean square error function;
[0021] The total loss of the first loss and the second loss is determined based on preset hyperparameters, and the initial code generation model is trained based on the total loss to obtain the target code model.
[0022] Optionally, after obtaining the target code pair input by the user, the method further includes:
[0023] Data augmentation is performed on the target code pairs to train the initial code generation model using the augmented target code pairs.
[0024] Optionally, performing warehouse management on the warehouse database using the operation code based on the target large language model includes:
[0025] Determine the features corresponding to the user instruction, and determine whether the user instruction is an access instruction to the warehouse database based on the features corresponding to the user instruction through a preset two-classification unit in the target large language model, so as to perform warehouse management on the warehouse database using the operation code according to the judgment result.
[0026] Optionally, performing warehouse management on the warehouse database according to the judgment result includes:
[0027] If the user instruction is the access instruction of the warehouse database, the dimension reduction layer is used to determine the dimension-reduced features corresponding to the user instruction;
[0028] Obtaining a structured query code of the dimensionally reduced feature corresponding to the user instruction using the code decoder, and accessing the storage database based on the structured query code to obtain an access result;
[0029] The access result is input into the target large language model to obtain corresponding post-access features, and the features corresponding to the user instructions are updated based on the post-access features, and the updated features are input into the target large language model.
[0030] In a second aspect, the present application provides a warehouse management device based on a large language model, comprising:
[0031] A database construction module is used to create a storage database based on preset warehouse information and preset cargo information; the initial state of the storage database is empty;
[0032] A model training module is used to construct an initial large language model and train the initial large language model based on a preset corpus to obtain a target large language model;
[0033] The warehouse management module is used to generate an operation code for the warehouse database based on a preset code generation method, and connect the target large language model to the warehouse database to perform warehouse management on the warehouse database using the operation code based on the target large language model.
[0034] In a third aspect, the present application provides an electronic device comprising a processor and a memory; wherein the memory is used to store a computer program, and the computer program is loaded and executed by the processor to implement the aforementioned warehouse management method based on a large language model.
[0035] In a fourth aspect, the present application provides a computer-readable storage medium for storing a computer program, which, when executed by a processor, implements the aforementioned warehouse management method based on a large language model.
[0036] In this application, a warehousing database is first created based on preset warehouse information and preset cargo information, and an initial large language model is constructed. The initial large language model is trained based on a preset corpus to obtain a target large language model. Then, an operation code for the warehousing database is generated based on a preset code generation method, and the target large language model is connected to the warehousing database, so as to perform warehousing management on the warehousing database based on the target large language model using the operation code. In this way, this application constructs a large language model and trains the model using a massive corpus based on a large model training method, so that it has basic language understanding and reasoning capabilities. Then, the large language model is connected to the database without the need for a special operation interface. Relevant personnel communicate with the system using natural language, and the warehousing system can automatically solve the user's related needs, eliminating the cost required for program developers to modify the code for specific functions, thereby improving the efficiency of warehousing management and the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0038] Figure 1 A flow chart of a warehouse management method based on a large language model provided in this application;
[0039] Figure 2 A flowchart of a specific warehouse management method based on a large language model provided in this application;
[0040] Figure 3 A schematic diagram of a code comparison method provided in this application;
[0041] Figure 4 A schematic diagram of the structure of a warehouse management device based on a large language model provided in this application;
[0042] Figure 5 This is a structural diagram of an electronic device provided in this application. DETAILED DESCRIPTION
[0043] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0044] At present, most of the solutions for warehouse logistics management systems in the industry are still proposed by the demanders, and software developers add functions to the system to meet the needs. However, this method is not scalable when conducting warehouse management, is limited to manual settings, and cannot integrate the system with other systems. This application constructs a large language model for training, so that it has basic language understanding and reasoning capabilities, and then connects the large language model to the database. Without the need for a special operating interface, relevant personnel communicate with the system using natural language, and the warehouse system can automatically solve the user's related needs.
[0045] See also Figure 1 As shown, an embodiment of the present invention discloses a warehouse management method based on a large language model, including:
[0046] Step S11: creating a warehousing database based on preset warehouse information and preset cargo information; the initial state of the warehousing database is empty.
[0047] In this embodiment, a warehouse database using a large language model is first constructed based on pre-defined warehouse and cargo information, or a common warehouse database template. This database structure allows for the creation and modification of warehouse and cargo information. It is understood that the warehouse database is initially empty and is updated when warehouses are added or cargo within a warehouse is modified. The database can be specifically divided into warehouse information, warehouse item information, and warehouse transaction information.
[0048] Step S12: construct an initial large language model, and train the initial large language model based on a preset corpus to obtain a target large language model.
[0049] In this embodiment, an initial large language model for warehouse database management can be constructed, and the large language model can be trained with a pre-set corpus to obtain a target large language model, so that after the large language model is trained with a massive corpus based on the large model training method, it can have basic language understanding and reasoning capabilities. It should also be pointed out that in this embodiment, a massive corpus can be used to evaluate the accuracy of the model during the training process. When the evaluation index reaches the target value, it is considered that the model has sufficient understanding and reasoning capabilities, and the training stops. By pre-training and fine-tuning the large language model with large-scale corpora such as Wikipedia, news articles, and social media, the large language model can adapt to different application scenarios and data sets, achieve better performance and effects, and help to build a warehouse management system in combination with the warehouse database in this embodiment.
[0050] Step S13: Generate an operation code for the warehousing database based on a preset code generation method, and connect the target large language model to the warehousing database to perform warehousing management on the warehousing database using the operation code based on the target large language model.
[0051] In this embodiment, the operation code of the warehouse database is constructed based on the preset code generation method and structured query language, and the target large language model is connected to the warehouse database, so that the warehouse database can be operated based on the target large language model using the operation code that can access the database to perform warehouse management. It is understandable that if only relying on the large language model to solve the warehouse logistics task, the short-term memory capacity of the large language model is unreliable. On the one hand, the amount of data that can be remembered is limited, and on the other hand, information that has not been used for a long time will be "forgotten". Therefore, in this embodiment, the storage of data is made into a separate module as a knowledge base of the large model. By storing the warehouse data in a separate database and connecting the model to the database, the long-distance forgetting problem of the model is solved.
[0052] In this embodiment, a warehousing database is first created based on preset warehouse information and preset cargo information, and an initial large language model is constructed. The initial large language model is trained based on a preset corpus to obtain a target large language model. Then, an operation code for the warehousing database is generated based on a preset code generation method, and the target large language model is connected to the warehousing database, so that the warehousing database is managed using the operation code based on the target large language model. In this way, a warehousing logistics system is built based on a large language model, and the model is trained using a massive corpus based on a large model training method so that it has basic language understanding and reasoning capabilities. After that, the large language model is connected to the database. Without a special operation interface, relevant personnel communicate with the system using natural language, and the warehousing system can automatically solve the user's related needs, eliminating the cost required for program developers to modify the code for specific functions, thereby improving the efficiency of warehousing management and the user experience.
[0053] Based on the previous embodiment, it can be seen that this application can build a warehousing and logistics system based on a large language model and connect the large language model to the database to avoid the cost of modifying the code for specific functions. Next, this embodiment will explain in detail the process of warehousing management based on a large language model. Figure 2 As shown, the embodiment of the present application discloses a specific warehouse management method based on a large language model, including:
[0054] Step S21: construct an initial code generation model based on the target large language module, obtain a target code pair input by the user, and train the initial code generation model based on the target code pair to generate corresponding operation codes based on the user instructions according to the obtained target code model.
[0055] In this embodiment, when generating the operation code for the warehouse database, a "few-sample semi-supervised natural language-code comparison learning" method is proposed, which allows the language model to generate the code to access the database to operate the database, thereby enabling the large language model to spontaneously access the database. It should be pointed out that in this embodiment, the database is usually accessed with a sentence of SQL (Structured Query Language) code. For example, to access the names of all goods in a warehouse A, you can use the code "SELECT name FROM inventory WHERE warehouse='A'". It is understandable that although the current large model can generate code after training, in terms of accuracy, the code generated by the small model is often more accurate or contains less messy information. Therefore, in order to allow the large language model to spontaneously access the database, this embodiment proposes a method such as Figure 3 The "few-shot semi-supervised natural language-code contrastive learning" method shown in the figure first builds an initial code generation model based on the target large language module, obtains the target code pairs consisting of the code and the corresponding action input by the user, and trains the initial code generation model based on the target code pairs to generate the corresponding operation code based on the user instruction according to the obtained target code model.
[0056] Specifically, when constructing the initial code generation model based on the target large language module, first, several hidden layers are added to the target large language model, including a code encoder, a code decoder, and a dimensionality reduction layer for language feature representation. Then, the action of the target code pair is input into the target large language model to obtain the feature corresponding to the action, and the feature is reduced in dimension through the dimensionality reduction layer to obtain the reduced feature. In this process, before the target code pair is input into the large language model, the target code pair can be data enhanced to train the initial code generation model using the enhanced target code pair. For example, given a series of (action, code) pairs, such as ("query all goods under warehouse A", "SELECT name FROM inventoryWHERE warehouse='A'"), these (action, code) pairs are enhanced, such as changing 'A' to 'B', to obtain more samples and improve the effect of model training. Then, the code of the target code pair is input into the code encoder to obtain the encoding corresponding to the code, and the corresponding feature representation is obtained by inputting the action into the language model. ; and input the corresponding code into the code encoder to obtain the corresponding code ; After dimensionality reduction, the reduced dimensionality features are obtained Then, based on contrastive learning and amplification, the first loss corresponding to the target code can be determined according to the features and encoding after dimensionality reduction. ; Then the above code Input to the code decoder to get the corresponding logit value , and based on the mean-square error function (MSE) to determine the above logit value and actual code The second loss between ; Then you can use the preset hyperparameters Determine the total loss of the first loss and the second loss , and based on the total loss, the initial code generation model is trained to obtain the target code model.
[0057] In this embodiment, the large language model will parse the user input and obtain an intermediate link, namely "feature representation", which is recorded as In addition, a small model of "input-encoder-decoder-output" can be built to generate code. The code is passed through the encoder to obtain the feature representation of the code, which is recorded as . The code itself is restored through the decoder. After dimensionality reduction, we get Feature matrices of the same dimension . Take the loss function , loss function The MSE loss between the logit of the decoder generated code and the actual, It should be noted that when training based on this training objective, only the encoder, decoder, and dimensionality reduction are trained, and the large model is not trained.
[0058] Step S22: determine the features corresponding to the user instruction, and determine whether the user instruction is an access instruction to the warehouse database based on the features corresponding to the user instruction through the preset two-classification unit in the target large language model, so as to perform warehouse management on the warehouse database using the operation code according to the judgment result.
[0059] In this embodiment, a binary classification head can be connected to the large model ,predict Indicates whether the operation accesses the database. Specifically, this can be done by determining the features corresponding to the user instructions and judging whether the user instructions are access instructions to the warehouse database based on the features corresponding to the user instructions by the preset two-classification unit in the target large language model, so as to perform warehouse management on the warehouse database using the operation code according to the judgment result.
[0060] If the user instruction is an access instruction to the storage database, the dimension reduction layer is used to determine the dimension reduction features corresponding to the user instruction, and the code decoder is used to obtain the structured query code of the dimension reduction features corresponding to the user instruction, and the storage database is accessed based on the structured query code to obtain the access result, and then the access result is input into the target large language model to obtain the corresponding post-access features, and the features corresponding to the user instruction are updated based on the post-access features, so as to input the updated features into the target large language model. In this embodiment, in the binary classification head When the prediction result is true, calculate And pass it into the decoder to get the SQL code to access the database, and input the result into the language model to get the feature representation of the data , and order , the superimposed new Used for subsequent actions in language models.
[0061] In this embodiment, an initial code generation model is constructed based on the target large language module, a target code pair input by the user is obtained, and the initial code generation model is trained based on the target code pair to generate corresponding operation codes based on the user instructions according to the obtained target code model, and then the features corresponding to the user instructions are determined, and the preset two-classification unit in the target large language model is used to judge whether the user instruction is an access instruction to the warehouse database based on the features corresponding to the user instruction, so as to use the operation code to perform warehouse management on the warehouse database according to the judgment result. In this way, the few-sample self-supervised natural language-code comparison learning method proposed in this embodiment can enable the language model to spontaneously generate SQL code to access the database while ensuring the structural integrity of the database, and build a warehousing and logistics system based on the large language model. By applying the system based on the large model to warehousing and logistics management, on the basis of the generalized large model pre-trained with a massive corpus, the basic functions of warehousing and logistics are fine-tuned to improve its accuracy in answering questions or processing transactions. Compared with traditional warehousing system development, there is no need for complicated work such as complicated code writing, debugging, and testing. Instead, you only need to "tell" the model the new functions you need, and the model can implement them for you, eliminating the cost required for program developers to modify the code for specific functions.
[0062] See also Figure 4 As shown, the embodiment of the present application further discloses a warehouse management device based on a large language model, comprising:
[0063] A database construction module 11 is used to create a storage database based on preset warehouse information and preset cargo information; the initial state of the storage database is empty;
[0064] A model training module 12 is used to construct an initial large language model and train the initial large language model based on a preset corpus to obtain a target large language model;
[0065] The warehouse management module 13 is used to generate an operation code for the warehouse database based on a preset code generation method, and connect the target large language model to the warehouse database to perform warehouse management on the warehouse database using the operation code based on the target large language model.
[0066] This embodiment first creates a warehouse database based on preset warehouse information and preset cargo information, and constructs an initial large language model, and trains the initial large language model based on a preset corpus to obtain a target large language model, and then generates an operation code for the warehouse database based on a preset code generation method, and connects the target large language model to the warehouse database, so as to perform warehouse management on the warehouse database based on the target large language model using the operation code. Through the above technical solution, a large language model can be constructed and trained using a massive corpus based on a large model training method, so that it has basic language understanding and reasoning capabilities, and then the large language model is connected to the database. Without a special operation interface, relevant personnel communicate with the system using natural language, and the warehouse system can automatically solve the user's related needs, eliminating the cost required for program developers to modify the code for specific functions, thereby improving the efficiency of warehouse management and the user experience.
[0067] In some specific embodiments, the warehouse management module 13 specifically includes:
[0068] A model generation submodule, configured to construct an initial code generation model based on the target large language module;
[0069] The model training submodule is used to obtain the target code pair input by the user and train the initial code generation model based on the target code pair to generate the corresponding operation code based on the user instruction according to the obtained target code model; wherein the target code pair includes the code input by the user and the corresponding action.
[0070] In some specific embodiments, the model generation submodule specifically includes:
[0071] A model building unit, configured to add a code encoder, a code decoder, and a dimensionality reduction layer to the hidden layer of the target large language model;
[0072] Accordingly, the model training submodule specifically includes:
[0073] A feature dimension reduction unit, configured to input the action of the target code pair into the target large language model, obtain features corresponding to the action, and reduce the features through the dimension reduction layer to obtain reduced features;
[0074] a code encoding unit, configured to input the code of the target code pair into the code encoder to obtain a code corresponding to the code;
[0075] A first loss determining unit, configured to determine a first loss corresponding to the target code based on the dimensionality-reduced features and the encoding;
[0076] a second loss determining unit, configured to input the code into the code decoder to obtain a corresponding logit value, and determine a second loss between the logit value and the code based on a mean square error function;
[0077] A total loss determining unit is used to determine the total loss of the first loss and the second loss based on preset hyperparameters, and to train the initial code generation model to obtain the target code model based on the total loss.
[0078] In some specific embodiments, the warehouse management module 13 further includes:
[0079] A data enhancement unit is used to perform data enhancement on the target code pair to train the initial code generation model using the enhanced target code pair.
[0080] In some specific embodiments, the warehouse management module 13 specifically includes:
[0081] An instruction judgment unit is used to determine the features corresponding to the user instruction, and judge whether the user instruction is an access instruction of the warehouse database based on the features corresponding to the user instruction through a preset two-classification unit in the target large language model, so as to use the operation code to perform warehouse management on the warehouse database according to the judgment result.
[0082] In some specific embodiments, the warehouse management module 13 specifically includes:
[0083] a feature determination unit, configured to, if the user instruction is the access instruction to the warehouse database, determine, using the dimensionality reduction layer, a dimensionally reduced feature corresponding to the user instruction;
[0084] A database access unit, configured to obtain a structured query code of the dimensionally reduced feature corresponding to the user instruction using the code decoder, and access the storage database based on the structured query code to obtain an access result;
[0085] A feature updating unit is configured to input the access result into the target large language model to obtain corresponding post-access features, update features corresponding to the user instructions based on the post-access features, and input the updated features into the target large language model.
[0086] Furthermore, the embodiment of the present application also discloses an electronic device, Figure 5 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram should not be considered as any limitation to the scope of application of the present application.
[0087] Figure 5 This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the warehouse management method based on a large language model disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0088] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device. The communication protocol it follows is any communication protocol that can be applied to the technical solution of this application and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world. Its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0089] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or CD, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0090] The operating system 221 is used to manage and control the hardware devices on the electronic device 20 and the computer program 222, and can be Windows Server, NetWare, Unix, Linux, etc. In addition to including a computer program capable of implementing the warehouse management method based on a large language model and executed by the electronic device 20 as disclosed in any of the aforementioned embodiments, the computer program 222 can further include computer programs capable of completing other specific tasks.
[0091] Furthermore, this application discloses a computer-readable storage medium for storing a computer program; wherein, when executed by a processor, the computer program implements the aforementioned large language model-based warehouse management method. The specific steps of this method can be found in the corresponding content disclosed in the aforementioned embodiments and will not be repeated here.
[0092] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from the other embodiments. Reference can be made to the descriptions of the identical or similar parts between the various embodiments. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and the relevant parts can be referred to the descriptions of the methods.
[0093] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0094] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0095] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.
[0096] The above is a detailed introduction to the technical solution provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, according to the ideas of the present application, there may be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A warehouse management method based on a large language model, characterized in that: include: Create a warehousing database based on preset warehouse information and preset cargo information; The initial state of the storage database is empty; Constructing an initial large language model, and training the initial large language model based on a preset corpus to obtain a target large language model; Generate an operation code for the storage database based on a preset code generation method, and connect the target large language model to the storage database, so as to perform storage management on the storage database using the operation code based on the target large language model; Wherein, the generating the operation code of the warehouse database based on the preset code generating method includes: Building an initial code generation model based on the target large language model; Obtaining a target code pair input by a user, and training the initial code generation model based on the target code pair, so as to generate a corresponding operation code based on the user instruction according to the obtained target code model; Wherein, the target code pair includes a code input by a user and a corresponding action; Furthermore, constructing an initial code generation model based on the target large language model includes: Adding a code encoder, a code decoder and a dimensionality reduction layer to the hidden layer of the target large language model; Accordingly, the step of obtaining the target code pair input by the user and training the initial code generation model based on the target code pair includes: Inputting the action of the target code pair into the target large language model to obtain features corresponding to the action, and reducing the dimensions of the features through the dimension reduction layer to obtain reduced-dimensional features; Inputting the code of the target code pair into the code encoder to obtain the code corresponding to the code; Determine a first loss corresponding to the target code based on the reduced-dimensionality features and the encoding; Inputting the code into the code decoder to obtain a corresponding logit value, and determining a second loss between the logit value and the code based on a mean square error function; The total loss of the first loss and the second loss is determined based on preset hyperparameters, and the initial code generation model is trained to obtain the target code model based on the total loss.
2. The warehouse management method based on a large language model according to claim 1 is characterized in that: The operation code is a code constructed based on structured query language.
3. The warehouse management method based on a large language model according to claim 1 is characterized in that: After obtaining the target code pair input by the user, the method further includes: Data enhancement is performed on the target code pair to train the initial code generation model using the enhanced target code pair.
4. The warehouse management method based on a large language model according to claim 1 is characterized in that: When the warehouse management of the warehouse database is performed by using the operation code based on the target large language model, it includes: Determine the features corresponding to the user instruction, and determine whether the user instruction is an access instruction to the warehouse database based on the features corresponding to the user instruction through a preset binary classification unit in the target large language model, so as to perform warehouse management on the warehouse database using the operation code according to the judgment result.
5. The warehouse management method based on a large language model according to claim 4 is characterized in that: The performing storage management on the storage database according to the judgment result includes: If the user instruction is the access instruction of the storage database, the dimension reduction layer is used to determine the dimension-reduced features corresponding to the user instruction; Using the code decoder to obtain a structured query code of the dimension-reduced feature corresponding to the user instruction, and accessing the storage database based on the structured query code to obtain an access result; The access result is input into the target large language model to obtain corresponding post-access features, and the features corresponding to the user instructions are updated based on the post-access features, and the updated features are input into the target large language model.
6. A warehouse management device based on a large language model, characterized in that: include: A database construction module, used to create a storage database based on preset warehouse information and preset goods information; The initial state of the storage database is empty; A model training module, used to construct an initial large language model and train the initial large language model based on a preset corpus to obtain a target large language model; A warehouse management module, used to generate an operation code for the warehouse database based on a preset code generation method, and connect the target large language model to the warehouse database, so as to perform warehouse management on the warehouse database using the operation code based on the target large language model; Wherein, the warehouse management module specifically includes: A model generation submodule, used to construct an initial code generation model based on the target large language model; A model training submodule, used to obtain a target code pair input by a user, and train the initial code generation model based on the target code pair, so as to generate a corresponding operation code based on the user instruction according to the obtained target code model; wherein the target code pair includes a code input by the user and a corresponding action; Furthermore, the model generation submodule specifically includes: A model building unit, used to add a code encoder, a code decoder and a dimensionality reduction layer in the hidden layer of the target large language model; Accordingly, the model training submodule specifically includes: A feature dimension reduction unit, used for inputting the action of the target code pair into the target large language model, obtaining features corresponding to the action, and reducing the features through the dimension reduction layer to obtain reduced-dimensional features; A code encoding unit, used for inputting the code of the target code pair into the code encoder to obtain a code corresponding to the code; A first loss determining unit, configured to determine a first loss corresponding to the target code based on the dimensionally reduced features and the encoding; A second loss determining unit, configured to input the code into the code decoder to obtain a corresponding logit value, and determine a second loss between the logit value and the code based on a mean square error function; A total loss determination unit is used to determine the total loss of the first loss and the second loss based on preset hyperparameters, and to train the initial code generation model to obtain the target code model based on the total loss.
7. An electronic device, characterized in that: The electronic device includes a processor and a memory; wherein the memory is used to store a computer program, and the computer program is loaded and executed by the processor to implement the warehouse management method based on a large language model as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: Used to store a computer program, which, when executed by a processor, implements the warehouse management method based on a large language model as described in any one of claims 1 to 5.
