Calculation demand processing method and device, medium and program product
By extracting formula retrieval keywords for financial computation problems through a pre-trained model, and combining them with a formula knowledge base and code generation model, the problem of insufficient understanding by large language models is solved, and high-accuracy computational requirement processing and resource optimization are achieved.
Patent Information
- Application Number
- CN202610133368.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-30
- Publication Date
- 2026-05-15
AI Technical Summary
In existing methods for handling computational demands, large language models struggle to accurately understand financial computation problems expressed in natural language input by users, resulting in low computational accuracy and wasted computing resources.
The pre-trained demand extraction model extracts formula retrieval keywords, uses a pre-set formula knowledge base to match candidate formula data, calls multiple code generation models in parallel to generate formula calculation code, and runs the code in a code sandbox to obtain the final calculation result.
It improved the accuracy of processing computing demands and enhanced the effective utilization rate of computing resources.
Smart Images

Figure CN122044858A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence technology, and in particular to a method, device, medium, and program product for processing computational needs. Background Technology
[0002] In financial business scenarios, various types of financial calculations are frequently involved. Automating the processing of financial calculation needs is of great significance for improving the efficiency of financial business processing.
[0003] Currently, existing methods for handling computational demands typically employ large language models to automatically perform financial calculations based on user-input financial questions and obtain corresponding results. However, due to issues such as illusions and insufficient financial knowledge learning, large language models struggle to accurately understand the formula requirements and financial parameters in the user's natural language-expressed financial calculation questions, leading to low calculation accuracy. Furthermore, repetitive, low-accuracy calculations result in a waste of computing resources, leading to low effective utilization of computing resources. Summary of the Invention
[0004] This invention provides a method, device, medium, and program product for processing computing requirements, which can achieve an accurate understanding of computing requirements, improve the accuracy of computing requirement processing, and enhance the effective utilization of computing resources.
[0005] According to one aspect of the present invention, a method for processing computational demands is provided, comprising: The system obtains the original computational problem expressed in natural language by the user, and processes the original computational problem through a pre-trained demand extraction model to extract formula retrieval keywords. The search keywords based on the formula are matched in a preset formula knowledge base to obtain the matched candidate formula data; Multiple pre-trained code generation models are invoked in parallel to generate formula calculation code based on the candidate formula data and the original calculation problem. The code calculation code for each formula is run using a code sandbox to obtain initial calculation results, and the final calculation result is determined based on the initial calculation results.
[0006] According to another aspect of the present invention, a computational demand processing apparatus is provided, comprising: The problem processing module is used to obtain the original computation problem expressed in natural language by the user, and process the original computation problem through a pre-trained demand extraction model to extract formula retrieval keywords; The formula matching module is used to match the formula with keywords in a preset formula knowledge base to obtain the matched candidate formula data. The code generation module is used to call multiple pre-trained code generation models in parallel to generate formula calculation code based on the candidate formula data and the original calculation problem. The result determination module is used to run the calculation code of each formula in a code sandbox, obtain each initial calculation result, and determine the final calculation result based on each initial calculation result.
[0007] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, which enables the at least one processor to perform the computational demand processing method according to any embodiment of the present invention.
[0008] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing a computer program configured to cause a processor to execute and implement the computational demand processing method described in any embodiment of the present invention.
[0009] According to another aspect of the present invention, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the computational demand processing method described in any embodiment of the present invention.
[0010] The technical solution of this invention involves obtaining the original computational problem expressed in natural language by the user, processing the original computational problem through a pre-trained requirement extraction model to extract formula retrieval keywords, matching the formula retrieval keywords in a preset formula knowledge base to obtain matched candidate formula data, calling multiple pre-trained code generation models in parallel to generate formula calculation code based on the candidate formula data and the original computational problem, running each formula calculation code in a code sandbox to obtain initial calculation results, and determining the final calculation result based on the initial calculation results. By combining the requirement extraction model and the preset formula knowledge base to obtain accurate formula data, and by calling multiple code generation models in parallel to generate formula calculation code, and by comprehensively considering the calculation results of each model code to determine the final calculation result, this approach can achieve an accurate understanding of computational requirements, improve the accuracy of computational requirement processing, and enhance the effective utilization of computing resources.
[0011] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0012] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0013] Figure 1 This is a flowchart of a computational demand processing method provided in Embodiment 1 of the present invention; Figure 2 This is a flowchart of a computational demand processing method provided in Embodiment 2 of the present invention; Figure 3 This is a schematic diagram of the structure of a computational demand processing device according to Embodiment 3 of the present invention; Figure 4 This is a schematic diagram of the structure of an electronic device that implements the computational demand processing method of the present invention. Detailed Implementation
[0014] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0015] It should be noted that the terms "first," "second," "modification," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such terms can be used interchangeably where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0016] Example 1 Figure 1This is a flowchart of a computational demand processing method provided in Embodiment 1 of the present invention. This embodiment is applicable to situations involving programmed computation of financial computational problems. The method can be executed by a computational demand processing device, which can be implemented in hardware and / or software. Typically, this computational demand processing device can be configured in an electronic device, such as a computer or server. Figure 1 As shown, the method includes: S110. Obtain the original computation problem expressed in natural language by the user, and process the original computation problem through a pre-trained demand extraction model to extract formula retrieval keywords.
[0017] It should be noted that, in this embodiment, the information collected is information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data all comply with the relevant laws, regulations and standards of the relevant countries and regions, necessary confidentiality measures have been taken, and they do not violate public order and good morals. Corresponding operation entry points are provided for users to choose to authorize or refuse.
[0018] In this embodiment, the original computational problem expressed by the user in natural language, such as voice or text, can be obtained. The original computational problem can be a computational problem related to financial transactions and may include information such as the computational scenario, computational objective, and computational parameters. Then, the original computational problem can be filled into a preset prompt word template to obtain the current prompt word. A pre-trained demand extraction model is then called to process the current prompt word to obtain the corresponding formula retrieval keywords.
[0019] The requirement extraction model can be a fine-tuned, trained large language model. In this embodiment, an open-source large language model can be obtained, and financial calculation problems can be collected. Then, the formula names corresponding to the financial calculation problems can be manually labeled as their corresponding tags to generate training samples. Finally, the training samples can be used to perform supervised fine-tuning training on the open-source large language model to obtain a large language model that meets the preset training termination conditions, which can then be used as the requirement extraction model.
[0020] For example, the original calculation problem is "A user paid A yuan into a personal pension fund, which starts to be returned after B years, with C yuan returned annually for a total of B years. What is the internal rate of return (IRR)?" After processing by the demand extraction model, the formula search keyword is "internal rate of return," indicating that the current calculation requires the use of the IRR calculation formula. It's understandable that in some specific cases, the original calculation problem may not directly contain the formula name. In such cases, the demand extraction model can still accurately extract the core formula query requirement from the original calculation problem to obtain the corresponding formula search keywords.
[0021] S120. Match the keywords retrieved according to the formula in the preset formula knowledge base to obtain the matched candidate formula data.
[0022] In this embodiment, a pre-generated correspondence between formula names and formula data can be established, and a preset formula knowledge base can be generated based on this correspondence. After obtaining the current formula search keywords, the formula search keywords can be matched with the formula names in each correspondence to obtain the formula names that match the formula search keywords. The formula data corresponding to these formula names is then used as the matched candidate formula data. The candidate formula data can be in machine-readable format, natural language description format, etc.
[0023] The matching detection between formula search keywords and formula names can be performed using methods such as cosine similarity and Euclidean distance, but this embodiment does not impose specific limitations on this.
[0024] Optionally, matching the keywords retrieved from the formula in a preset formula knowledge base to obtain matched candidate formula data may include: If the formula search keywords fail to match the preset formula knowledge base, the search engine is invoked to perform a search based on the formula search keywords in order to obtain the formula search results and the corresponding data types. The formula retrieval results are standardized according to the data type to obtain candidate formula data.
[0025] In this embodiment, if no matching entries are successfully retrieved from the preset formula knowledge base based on the formula search keywords—for example, if the similarity between the formula search keywords and the names of all formulas in the preset formula knowledge base is less than a preset threshold—then a preset search engine is invoked to perform an information search based on the formula search keywords to obtain formula search results. The formula search results can be of data types such as images and text. Next, based on the preset correspondence between data types and processing strategies, the processing strategy corresponding to the current data type can be obtained, and the formula search results can be standardized based on this processing strategy to obtain corresponding candidate formula data.
[0026] For example, when the data type is text, the processing strategy could be to perform natural language processing on the formula retrieval results to obtain candidate formula data. Alternatively, when the data type is image, the processing strategy could be to first preprocess the formula retrieval results to obtain preprocessed formula images, and then perform formula recognition on the preprocessed formula images to obtain candidate formula data.
[0027] In this embodiment, by setting up a search engine to supplement and extract formula data, the recall probability of formula data can be improved, and the success rate of processing calculation requirements can be increased.
[0028] Optionally, standardizing the formula retrieval results according to the data type to obtain candidate formula data may include: If the data type is determined to be an image, the formula retrieval result is preprocessed to obtain a binarized formula image. The Hough transform method is used to perform formula line detection on the binarized formula image to obtain the formula line detection result, and the tilt angle is calculated based on the formula line detection result. The binarized formula image is tilted according to the tilt angle to obtain a target formula image, and the target formula image is then used for formula recognition to obtain candidate formula data.
[0029] In this embodiment, when the data type of the formula retrieval result is an image, the formula retrieval result can first be preprocessed, including grayscale conversion, denoising, and binarization, to obtain a binarized formula image. Then, the Hough transform method is used to detect horizontal lines (such as minus signs) and vertical lines in the formula within the binarized formula image to obtain line detection results. Next, the angle between the detected horizontal line and the horizontal line, and the angle between the vertical line and the vertical line, can be calculated, and the average of the two angle values can be calculated to obtain the tilt angle. Further, the binarized formula image can be rotated and corrected based on this tilt angle to obtain the target formula image. Finally, a contour localization method can be used to crop the formula region from the target formula image, and a specified mathematical formula recognition tool can be used to extract candidate formula data from the formula region image.
[0030] In this embodiment, by preprocessing, tilt correction, and formula recognition of the formula retrieval results of the image type, candidate formula data can be obtained, which can improve the accuracy of the candidate formula data.
[0031] S130. Multiple pre-trained code generation models are invoked in parallel to generate formula calculation code based on the candidate formula data and the original calculation problem.
[0032] In this embodiment, firstly, a current prompt word can be constructed based on candidate formula data and the original calculation problem. Then, multiple code generation models of different types can be invoked in parallel to process the current prompt word and obtain the formula calculation code output by each code generation model. Typically, the number of code generation models can be odd to increase the probability of successfully obtaining the final calculation result. For example, the current prompt word could be "Candidate formula data is a, original calculation problem is b, you are a professional financial calculation robot, generate formula calculation code based on the above formula data and calculation problem."
[0033] In this embodiment, multiple basic large language models with different model structures and parameters can be obtained in advance, and the mapping relationship between financial calculation problems, formula data and formula calculation code can be generated as training samples. Then, the basic large language models can be fine-tuned and trained using the training samples to obtain multiple final code generation models.
[0034] S140. Run the calculation code of each formula using a code sandbox, obtain each initial calculation result, and determine the final calculation result based on each initial calculation result.
[0035] In this embodiment, after obtaining the formula calculation code corresponding to each code generation model, a code sandbox can be built using lightweight container technology, and each formula calculation code can be run separately in the code sandbox to obtain the corresponding initial calculation results. Then, the one that appears most frequently among all the initial calculation results can be selected as the final calculation result.
[0036] It is understandable that in the process of processing computational demands, each step (such as model invocation, information retrieval, and code execution) requires certain computing and storage resources. When the accuracy of computational demand processing is low, it leads to a serious waste of computing and storage resources. The technical solution of this invention can improve the effective utilization rate of computing and storage resources by improving the accuracy of computational demand processing.
[0037] The technical solution of this invention involves obtaining the original computational problem expressed in natural language by the user, processing the original computational problem through a pre-trained requirement extraction model to extract formula retrieval keywords, matching the formula retrieval keywords in a preset formula knowledge base to obtain matched candidate formula data, calling multiple pre-trained code generation models in parallel to generate formula calculation code based on the candidate formula data and the original computational problem, running each formula calculation code in a code sandbox to obtain initial calculation results, and determining the final calculation result based on the initial calculation results. By combining the requirement extraction model and the preset formula knowledge base to obtain accurate formula data, and by calling multiple code generation models in parallel to generate formula calculation code, and by comprehensively considering the calculation results of each model code to determine the final calculation result, this approach can achieve an accurate understanding of computational requirements, improve the accuracy of computational requirement processing, and enhance the effective utilization of computing resources.
[0038] Example 2 Figure 2 This is a flowchart of a computational demand processing method provided in Embodiment 2 of the present invention. This embodiment is a further refinement of the above technical solution, and the technical solution in this embodiment can be combined with one or more of the above implementation methods. Figure 2 As shown, the method includes: S210. Obtain the original computation problem expressed in natural language by the user, and process the original computation problem through a pre-trained demand extraction model to extract formula retrieval keywords.
[0039] S220. Match the keywords retrieved according to the formula in a preset formula knowledge base to obtain the matched candidate formula data.
[0040] S230. Multiple pre-trained code generation models are invoked in parallel to generate formula calculation code based on the candidate formula data and the original calculation problem.
[0041] S240. Run the calculation code of each formula using a code sandbox to obtain each initial calculation result, and perform deduplication on each initial calculation result to obtain each intermediate calculation result, and count the occurrence frequency of each intermediate calculation result.
[0042] In this embodiment, after obtaining the initial calculation result corresponding to each formula calculation code, several intermediate calculation results without repetition can be selected from all the initial calculation results, and the number of times each intermediate calculation result appears in all the initial calculation results can be counted as the corresponding frequency of occurrence.
[0043] S250. Based on the frequency of occurrence, obtain the consistency score corresponding to each intermediate calculation result, and based on the consistency score corresponding to each intermediate calculation result, obtain the consistency score corresponding to each initial calculation result.
[0044] Specifically, the frequency of occurrence of each intermediate calculation result can be divided by the total number of initial calculation results to obtain the quotient as the consistency score corresponding to that intermediate calculation result, thereby automatically obtaining the consistency score corresponding to each initial calculation result.
[0045] S260. Based on the consistency scores, determine the final calculation result from the initial calculation results.
[0046] Specifically, the maximum consistency score is determined among all consistency scores, and the initial calculation result corresponding to the maximum consistency score is selected as the final calculation result. For example, if the initial calculation results are d, d, e, and f, and the intermediate calculation results are d (corresponding to a frequency of 2), e (corresponding to a frequency of 1), and f (corresponding to a frequency of 1), the consistency scores corresponding to each intermediate calculation result are 2 / 4 = 0.5, 1 / 4 = 0.25, and 1 / 4 = 0.25, respectively. Therefore, the maximum consistency score is 0.5, and the final calculation result is d.
[0047] Optionally, determining the final calculation result from the initial calculation results based on each of the consistency scores may include: Based on each consistency score, obtain the maximum consistency score, and determine whether the maximum consistency score corresponds to a unique intermediate calculation result. If so, determine the intermediate calculation result corresponding to the maximum consistency score as the final calculation result.
[0048] In an optional example, when determining the final calculation result, first, the maximum consistency score is determined among all consistency scores; then, if it is determined that there is only one intermediate calculation result corresponding to the maximum consistency score, the intermediate calculation result can be directly determined as the final calculation result.
[0049] In this embodiment, by selecting the intermediate calculation result corresponding to the maximum consistency score as the final calculation result, the efficiency of obtaining the final calculation result can be improved, and the efficiency of processing calculation requirements can be improved.
[0050] Optionally, after determining whether the maximum consistency score corresponds to a unique intermediate calculation result, the following may also be included: If it is determined that the maximum consistency score corresponds to multiple candidate intermediate calculation results, then obtain the result selection weight of each code generation model matching corresponding to each candidate intermediate calculation result; Based on the matching results of each code generation model, select weights, obtain the target weights corresponding to each candidate intermediate calculation result, and determine the final calculation result from each candidate intermediate calculation result based on the target weights.
[0051] In another scenario, if multiple intermediate calculation results are detected to simultaneously possess the maximum consistency score (meaning they occur with the same frequency), these intermediate results can be identified as candidate intermediate calculation results. Next, based on the correspondence between the calculation results, the formula calculation code, and the code generation model, the corresponding code generation model for each candidate intermediate calculation result can be determined. Further, the number of result selections for each code generation model is read from a specified database, and this number of selections is multiplied by a preset single-selection weight to obtain the product, which serves as the result selection weight for the code generation model. Here, the number of result selections represents the number of times historically the calculation result corresponding to the formula calculation code generated by the code generation model has been selected as the final calculation result.
[0052] Then, the weights of all code generation model matching results corresponding to each candidate intermediate calculation result can be added together to obtain the sum, which is used as the target weight corresponding to that candidate intermediate calculation result. Finally, the candidate intermediate calculation result corresponding to the maximum target weight can be selected as the final calculation result.
[0053] In this embodiment, by introducing the result selection weight corresponding to the code generation model, the final calculation result can be determined in an auxiliary manner, thereby improving the success recall probability of the final calculation result and further improving the accuracy of the calculation requirement processing.
[0054] Optionally, obtaining the result selection weights for each code generation model matching corresponding to each of the candidate intermediate calculation results may include: Obtain the total number of calls and the number of result selections for each code generation model, and based on the total number of calls and the number of result selections, obtain the result selection weights for each code generation model corresponding to each candidate intermediate calculation result.
[0055] In an optional example, when determining the result selection weight, the total number of calls and the number of result selections for each code generation model in history can be read. Then, the quotient value obtained by dividing the number of result selections by the total number of calls can be used as the corresponding result selection weight. Specifically, after each computational requirement is processed, the total number of calls and the number of result selections for each code generation model are updated in real time based on the model call and result selection information.
[0056] In this embodiment, by determining the result selection weight of the code generation model matching based on the total number of calls and the number of result selections, the rationality and accuracy of the weight setting can be improved.
[0057] The technical solution of this invention involves deduplicating each initial calculation result to obtain intermediate calculation results, and statistically calculating the frequency of occurrence of each intermediate calculation result. Based on the frequency of occurrence, a consistency score is obtained for each intermediate calculation result, and based on the consistency score of each intermediate calculation result, a consistency score is obtained for each initial calculation result. Based on each consistency score, a final calculation result is determined from each initial calculation result. By evaluating the consistency of the calculation results based on their frequency of occurrence to obtain corresponding consistency scores, and by filtering based on the consistency scores to obtain the final calculation result, the accuracy of the final calculation result can be improved.
[0058] Example 3 Figure 3 This is a schematic diagram of a computational demand processing device provided in Embodiment 3 of the present invention. Figure 3 As shown, the device includes: a problem processing module 310, a formula matching module 320, a code generation module 330, and a result determination module 340; wherein, The problem processing module 310 is used to obtain the original computation problem expressed in natural language by the user, and process the original computation problem through a pre-trained demand extraction model to extract formula retrieval keywords; Formula matching module 320 is used to match the formula search keywords in a preset formula knowledge base to obtain the matched candidate formula data; Code generation module 330 is used to call multiple pre-trained code generation models in parallel to generate formula calculation code based on the candidate formula data and the original calculation problem; The result determination module 340 is used to run the calculation code of each formula in a code sandbox, obtain each initial calculation result, and determine the final calculation result based on each initial calculation result.
[0059] The technical solution of this invention involves obtaining the original computational problem expressed in natural language by the user, processing the original computational problem through a pre-trained requirement extraction model to extract formula retrieval keywords, matching the formula retrieval keywords in a preset formula knowledge base to obtain matched candidate formula data, calling multiple pre-trained code generation models in parallel to generate formula calculation code based on the candidate formula data and the original computational problem, running each formula calculation code in a code sandbox to obtain initial calculation results, and determining the final calculation result based on the initial calculation results. By combining the requirement extraction model and the preset formula knowledge base to obtain accurate formula data, and by calling multiple code generation models in parallel to generate formula calculation code, and by comprehensively considering the calculation results of each model code to determine the final calculation result, this approach can achieve an accurate understanding of computational requirements, improve the accuracy of computational requirement processing, and enhance the effective utilization of computing resources.
[0060] Optionally, the formula matching module 320 includes: The formula retrieval unit is used to call a search engine to retrieve formulas based on the formula retrieval keywords if the formula retrieval keywords fail to match the preset formula knowledge base, so as to obtain the formula retrieval results and the corresponding data types. The result processing unit is used to standardize the formula retrieval results according to the data type to obtain candidate formula data.
[0061] Optionally, the result processing unit is specifically used to preprocess the formula retrieval result to obtain a binarized formula image if the data type is determined to be an image. The Hough transform method is used to perform formula line detection on the binarized formula image to obtain the formula line detection result, and the tilt angle is calculated based on the formula line detection result. The binarized formula image is tilted according to the tilt angle to obtain a target formula image, and the target formula image is then used for formula recognition to obtain candidate formula data.
[0062] Optionally, the result determination module 340 includes: The frequency statistics unit is used to perform deduplication on each of the initial calculation results to obtain each intermediate calculation result, and to count the occurrence frequency of each intermediate calculation result. The scoring acquisition unit is used to acquire the consistency score corresponding to each intermediate calculation result based on the occurrence frequency, and to acquire the consistency score corresponding to each initial calculation result based on the consistency score corresponding to each intermediate calculation result. The result determination unit is used to determine the final calculation result from the initial calculation results based on the consistency scores.
[0063] Optionally, the result determination unit is specifically used to obtain the maximum consistency score based on each of the consistency scores, and to determine whether the maximum consistency score corresponds to a unique intermediate calculation result. If so, the intermediate calculation result corresponding to the maximum consistency score is determined as the final calculation result.
[0064] Optionally, the result determination unit includes: The weight acquisition subunit is used to acquire the result selection weight of each code generation model matching corresponding to each candidate intermediate calculation result if it is determined that the maximum consistency score corresponds to multiple candidate intermediate calculation results. The result determination subunit is used to select weights based on the matching results of each code generation model, obtain the target weights corresponding to each candidate intermediate calculation result, and determine the final calculation result from each candidate intermediate calculation result based on the target weights.
[0065] Optionally, the weight acquisition subunit is specifically used to acquire the total number of calls and the number of result selections corresponding to each of the code generation models, and to acquire the result selection weights matched by each code generation model corresponding to each of the candidate intermediate calculation results based on the total number of calls and the number of result selections.
[0066] The computational demand processing device provided in the embodiments of the present invention can execute the computational demand processing method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the method execution.
[0067] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0068] Example 4 Figure 4A schematic diagram of an electronic device 40 that can be used to implement embodiments of the present invention is shown. The electronic device 40 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device 40 can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0069] like Figure 4 As shown, the electronic device 40 includes at least one processor 41 and a memory, such as a read-only memory (ROM) 42 or a random access memory (RAM) 43, communicatively connected to the at least one processor 41. The memory stores computer programs executable by the at least one processor. The processor 41 can perform various appropriate actions and processes based on the computer program stored in the read-only memory 42 or loaded from the storage unit 48 into the random access memory 43. The RAM 43 can also store various programs and data required for the operation of the electronic device 40. The processor 41, ROM 42, and RAM 43 are interconnected via a bus 44. An input / output (I / O) interface 45 is also connected to the bus 44.
[0070] Multiple components in electronic device 40 are connected to I / O interface 45, including: input unit 46, such as keyboard, mouse, etc.; output unit 47, such as various types of monitors, speakers, etc.; storage unit 48, such as disk, optical disk, etc.; and communication unit 49, such as network card, modem, wireless transceiver, etc. Communication unit 49 allows electronic device 40 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0071] Processor 41 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 41 include, but are not limited to, central processing units, graphics processing units, various special-purpose artificial intelligence computing chips, various processors running machine learning model algorithms, digital signal processors, and any suitable processor, controller, microcontroller, etc. Processor 41 performs the various methods and processes described above, such as computational demand processing methods.
[0072] In some embodiments, the computational demand processing method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 48. In some embodiments, part or all of the computer program may be loaded and / or mounted on electronic device 40 via ROM 42 and / or communication unit 49. When the computer program is loaded into RAM 43 and executed by processor 41, one or more steps of the computational demand processing method described above may be performed. Alternatively, in other embodiments, processor 41 may be configured to perform the computational demand processing method by any other suitable means (e.g., by means of firmware).
[0073] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays, application-specific integrated circuits (ASICs), application-specific standard products (ASICs), system-on-a-chip (SoCs), complex programmable logic devices, computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0074] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0075] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory, read-only memory, erasable programmable read-only memory, optical fibers, portable compact disk read-only memory, optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0076] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device 40, which includes: a display device (e.g., a cathode ray tube or liquid crystal display) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device 40. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0077] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0078] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact via a communication network. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server.
[0079] This embodiment may also include a computer program product, which includes a computer program that, when executed by a processor, implements the computational requirement processing method provided in any embodiment of the present invention.
[0080] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0081] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method for processing computational demands, characterized in that, include: The system obtains the original computational problem expressed in natural language by the user, and processes the original computational problem through a pre-trained demand extraction model to extract formula retrieval keywords. The search keywords based on the formula are matched in a preset formula knowledge base to obtain the matched candidate formula data; Multiple pre-trained code generation models are invoked in parallel to generate formula calculation code based on the candidate formula data and the original calculation problem. The code calculation code for each formula is run using a code sandbox to obtain initial calculation results, and the final calculation result is determined based on the initial calculation results.
2. The method according to claim 1, characterized in that, The search keywords based on the formula are matched against a preset formula knowledge base to obtain candidate formula data, including: If the formula search keywords fail to match the preset formula knowledge base, the search engine is invoked to perform a search based on the formula search keywords in order to obtain the formula search results and the corresponding data types. The formula retrieval results are standardized according to the data type to obtain candidate formula data.
3. The method according to claim 2, characterized in that, The formula retrieval results are standardized according to the data type to obtain candidate formula data, including: If the data type is determined to be an image, the formula retrieval result is preprocessed to obtain a binarized formula image. The Hough transform method is used to perform formula line detection on the binarized formula image to obtain the formula line detection result, and the tilt angle is calculated based on the formula line detection result. The binarized formula image is tilted according to the tilt angle to obtain a target formula image, and the target formula image is then used for formula recognition to obtain candidate formula data.
4. The method according to claim 1, characterized in that, The final calculation result is determined based on the initial calculation results described above, including: The initial calculation results are deduplicated to obtain intermediate calculation results, and the frequency of occurrence of each intermediate calculation result is statistically analyzed. Based on the frequency of occurrence, obtain the consistency score corresponding to each intermediate calculation result, and based on the consistency score corresponding to each intermediate calculation result, obtain the consistency score corresponding to each initial calculation result. Based on the consistency scores, the final calculation result is determined from the initial calculation results.
5. The method according to claim 4, characterized in that, Based on the consistency scores, the final calculation result is determined from the initial calculation results, including: Based on each consistency score, obtain the maximum consistency score, and determine whether the maximum consistency score corresponds to a unique intermediate calculation result. If so, determine the intermediate calculation result corresponding to the maximum consistency score as the final calculation result.
6. The method according to claim 5, characterized in that, After determining whether the maximum consistency score corresponds to a unique intermediate calculation result, the method further includes: If it is determined that the maximum consistency score corresponds to multiple candidate intermediate calculation results, then obtain the result selection weight of each code generation model matching corresponding to each candidate intermediate calculation result; Based on the matching results of each code generation model, select weights, obtain the target weights corresponding to each candidate intermediate calculation result, and determine the final calculation result from each candidate intermediate calculation result based on the target weights.
7. The method according to claim 6, characterized in that, Obtain the result selection weights for each code generation model matching corresponding to each of the aforementioned candidate intermediate calculation results, including: Obtain the total number of calls and the number of result selections for each code generation model, and based on the total number of calls and the number of result selections, obtain the result selection weights for each code generation model corresponding to each candidate intermediate calculation result.
8. An electronic device, characterized in that, The electronic device includes: At least one processor, and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the computational demand processing method according to any one of claims 1-7.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that causes a processor to execute the computational demand processing method according to any one of claims 1-7.
10. A computer program product, characterized in that, It includes a computer program that, when executed by a processor, implements the computational demand processing method according to any one of claims 1-7.