Testing Benchmark Generation Method and Testing Benchmark Generation System Capable of Adjusting Prompt Data

The method and system use a large language model to generate and verify code snippets against product constraints, addressing the limitations of conventional benchmarks by producing adaptable testing benchmarks for diverse architectures.

US20260377293A1Pending Publication Date: 2026-11-26MEDIATEK INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
US19/758985
Authority / Receiving Office
US · United States
Patent Type
Applications(United States)
Current Assignee / Owner
Priority Date
2023-03-17
Filing Date
2026-07-30
Publication Date
2026-11-26

AI Technical Summary

Technical Problem

Conventional testing benchmarks fail to cover various hardware and software architectures, limiting their applicability and effectiveness in evaluating product performance.

Method used

A testing benchmark generation method and system utilizing a large language model (LLM) to generate, execute, and verify code snippets based on product constraints, incorporating a two-step verification mechanism to ensure compliance with constraints before adding them to the benchmark data.

Benefits of technology

Generates optimal testing benchmarks adaptable to diverse hardware and software architectures by filtering out non-compliant code snippets, ensuring comprehensive evaluation of product performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure US20260377293A1-D00000_ABST
    Figure US20260377293A1-D00000_ABST
Patent Text Reader

Abstract

A testing benchmark generation method includes generating prompt data according to at least one constraint of a product; generating, by a large language model (LLM), a candidate code snippet according to the prompt data; executing the candidate code snippet under the product to obtain an execution result; determining, based on a comparison of the execution result with the at least one constraint, whether the candidate code snippet matches the at least one constraint; and, in response to determining that the candidate code snippet matches the at least one constraint, adding the candidate code snippet to testing benchmark data.
Need to check novelty before this filing date? Find Prior Art

Description

CROSS REFERENCE TO RELATED APPLICATION

[0001] This application is a continuation application of U.S. application Ser. No. 18 / 603,186, filed on Mar. 12, 2024, which claims the benefit of U.S. Provisional Application No. 63 / 490,797, filed on Mar. 17, 2023. The contents of these applications are incorporated herein by reference.BACKGROUND

[0002] With the rapid development of science and technology, an increasing number of companies and research institutions look for efficient and professional testing benchmarks to evaluate their product performance. However, conventional testing benchmarks may not cover all specific hardware and software architectures since the conventional testing benchmarks are user-defined or generated by credible institutions.

[0003] Therefore, developing a benchmark generation method capable of applying to various hardware and software architectures is an important research issue.SUMMARY

[0004] In an embodiment, a testing benchmark generation method for a product is disclosed. The testing benchmark generation method comprises generating prompt data according to at least one constraint of the product; generating, by a large language model (LLM), a candidate code snippet according to the prompt data; executing the candidate code snippet under the product to obtain an execution result; determining, based on a comparison of the execution result with the at least one constraint, whether the candidate code snippet matches the at least one constraint; and, in response to determining that the candidate code snippet matches the at least one constraint, adding the candidate code snippet to testing benchmark data.

[0005] In another embodiment, a testing benchmark generation system for a product is disclosed. The testing benchmark generation system comprises a prompt generation module, an inference module, a profiling module, and a testing benchmark generation module. The prompt generation module is configured to generate prompt data according to at least one constraint of the product. The inference module is coupled to the prompt generation module and configured to generate, by a large language model (LLM), a candidate code snippet according to the prompt data and execute the candidate code snippet under the product to obtain an execution result. The profiling module is coupled to the inference module and configured to determine, based on a comparison of the execution result with the at least one constraint, whether the candidate code snippet matches the at least one constraint. The testing benchmark generation module is coupled to the profiling module and comprises a memory. The testing benchmark generation module is configured to store the candidate code snippet in the memory as part of testing benchmark data in response to the profiling module determining that the candidate code snippet matches the at least one constraint.

[0006] These and other objectives of the present invention will no doubt become obvious to those of ordinary skill in the art after reading the following detailed description of the preferred embodiment that is illustrated in the various figures and drawings.BRIEF DESCRIPTION OF THE DRAWINGS

[0007] FIG. 1 is a block diagram of a testing benchmark generation system according to an embodiment of the present invention.

[0008] FIG. 2 is a flow chart of a prompt generation process performed by a prompt generation module of the testing benchmark generation system in FIG. 1.

[0009] FIG. 3 is a flow chart of an inference process performed by an inference module of the testing benchmark generation system in FIG. 1.

[0010] FIG. 4 is a flow chart of a profiling process performed by a profiling module of the testing benchmark generation system in FIG. 1.

[0011] FIG. 5 is a flow chart of a testing benchmark generation method performed by a testing benchmark generation system in FIG. 1.DETAILED DESCRIPTION

[0012] FIG. 1 is a block diagram of a testing benchmark generation system 100 according to an embodiment of the present invention. The testing benchmark generation system includes a prompt generation module 10, an inference module 11, a profiling module 12, a prompt adjustment module 13, and a testing benchmark generation module 14. The prompt generation module is used for generating prompt data. The inference module 11 is coupled to the prompt generation module 10 for generating and checking a code snippet. The profiling module 12 is coupled to the inference module 11 and a product 15 for analyzing an execution result of the code snippet operated under the product 15. The prompt adjustment module 13 is coupled to the inference module 11 and the profiling module 12 for adjusting the prompt data. The testing benchmark generation module 14 is coupled to the profiling module 12 for generating testing benchmark data. In the testing benchmark generation system 100, after the prompt generation module 10 generates the prompt data of the product 15, the inference module 11 generates the code snippet by a large language model (LLM) according to the prompt data. Here, the LLM can be an artificial intelligence (AI) accelerator-based language model. For example, the LLM can be a Generative Pre-training Transformer (GPT) language model. The inference module 11 can semantically check the code snippet for determining if the code snippet is successfully verified. Then, the profiling module 12 analyzes the execution result corresponding to the code snippet after the code snippet is executed under the product 15. The profiling module 12 compares the execution result corresponding to the code snippet with at least one constraint of the product 15 for determining if the code snippet matches the at least one constraint. Then, the profiling module 12 adds the code snippet to the testing benchmark data of the testing benchmark generation module 14. The testing benchmark generation module 14 can be a memory for buffering and updating the testing benchmark data. In other words, the testing benchmark generation system 100 can generate appropriate code snippets to form the testing benchmark data for applying to various software and hardware architectures. Here, the product 15 can include a hardware-product or a software-product. Operation details of the testing benchmark generation system 100 are illustrated below.

[0013] FIG. 2 is a flow chart of a prompt generation process performed by a prompt generation module 10 of the testing benchmark generation system 100. The prompt generation process can include step S201 to step S203. Any reasonable technology modification falls into the scope of the present invention. Step S201 to step S203 are illustrated below.

[0014] step S201: providing the product 15;

[0015] step S202: performing an architecture analysis mechanism of the product 15;

[0016] step S203: generating prompt data according to at least one constraint of the product 15.

[0017] In step S201, the product 15 is provided. As previously mentioned, the product 15 can be the hardware-product or the software-product. In the testing benchmark generation system 100, when the product 15 is the hardware-product, the testing benchmark data can be used for profiling hardware performance. When the product 15 includes the software-product, the testing benchmark data can be used for testing robustness of a compiler corresponding to the software-product. Then, in step S202, the prompt generation module 10 can perform an architecture analysis mechanism of the product 15. For example, the prompt generation module 10 can automatically analyze the product 15 according to its features, properties, behaviors, and / or characteristics. Alternatively, the prompt generation module 10 can be used for analyzing the product 15. Then, the prompt generation module 10 can generate prompt data according to at least one constraint of the product 15. For example, the at least one constraint can be related to CPU performance of CoreMark or Geekbench. Here, the prompt data can be generated according to task description data, code snippet format data, constraint data, and few-shot learning data. The task description data is generated according to hardware or software architectures. The task description data can be used for determining which code snippets are generated for testing the product 15. The code snippet format data is used for determining coding formats generated by the LLM. The constraint data can be used for illustrating constraints of the code snippets generated by the LLM. The few-shot learning data can be sample data or experimental data optionally introduced to the prompt data. In step S203, the prompt generation module 10 can generate prompt data according to at least one constraint of the product 15. Here, the prompt data can be in a form of text data. The prompt data is inputted to the LLM for generating the code snippet corresponding to each testing item of the product 15.

[0018] FIG. 3 is a flow chart of an inference process performed by the inference module 11 of the testing benchmark generation system 100. The inference process can include step S301 to step S304. Any reasonable technology modification falls into the scope of the present invention. Step S301 to step S304 are illustrated below.

[0019] step S301: acquiring the prompt data;

[0020] step S302: generating the code snippet by the LLM according to the prompt data;

[0021] step S303: semantically checking the code snippet for verifying a validation of the code snippet;

[0022] step S304: compiling the code snippet and executing the code snippet under the product 15 when the code snippet is successfully verified.

[0023] In step S301, the inference module 11 acquires the prompt data from the prompt generation module 10. Then, in step S302, the code snippet can be generated by the LLM according to the prompt data. After the code snippet is generated, the inference module 11 can semantically check the code snippet for verifying a validation of the code snippet in step S303. For example, the inference module 11 can check the code snippet for determining if a code semantics format of the code snippet satisfies a designated programming language. Then, the inference module 11 can acquire a check result of the code semantics format for determining if the code snippet is successfully verified. In step S304, when the code snippet is successfully verified, it implies that the code snippet is valid. Then, the code snippet can be compiled and executed under the product 15.

[0024] FIG. 4 is a flow chart of a profiling process performed by the profiling module 12 of the testing benchmark generation system 100. The profiling process can include step S401 to step S404. Any reasonable technology modification falls into the scope of the present invention. Step S401 to step S404 are illustrated below.

[0025] step S401: receiving an execution result corresponding to the code snippet after the code snippet is executed under the product 15;

[0026] step S402: analyzing the execution result corresponding to the code snippet by a profiling tool;

[0027] step S403: comparing the execution result corresponding to the code snippet with the at least one constraint of the product 15;

[0028] step S404: outputting the code snippet from the profiling module 12 when the code snippet matches the at least one constraint.

[0029] In step S401, the profiling module 12 can receive the execution result corresponding to the code snippet from the inference module 11 after the code snippet is executed under the product 15. Then, in step S402, the profiling module 12 can analyze the execution result corresponding to the code snippet by a profiling tool. Here, the profiling tool can automatically analyze the execution result corresponding to the code snippet. Alternatively, the profiling tool can be used for analyzing the execution result corresponding to the code snippet. In step S403, the profiling module 12 can compare the execution result corresponding to the code snippet with the at least one constraint of the product 15. If the execution result meets the at least one constraint, it implies that the code snippet corresponds to a preconfigured testing item of the product 15. Therefore, in step S404, the profiling module 12 can output the code snippet to the testing benchmark generation module 14 for adding the code snippet to the testing benchmark data when the code snippet matches the at least one constraint. In other words, an “appropriate” code snippet can be introduced to the testing benchmark data. Therefore, the testing benchmark data of the testing benchmark generation system 100 can be applied to various hardware and software architectures.

[0030] FIG. 5 is a flow chart of a testing benchmark generation method performed by the testing benchmark generation system 100. The testing benchmark generation method can include step S501 to step S511. Any reasonable technology modification falls into the scope of the present invention. Step S501 to step S511 are illustrated below.

[0031] step S501: setting a maximum number of code snippets;

[0032] step S502: determining if an amount of testing snippets has reached the maximum number of code snippets, if yes, entering step S511, else, entering step S503;

[0033] step S503: generating the prompt data of the product 15 by the prompt generation module 10;

[0034] step S504: generating the code snippet by the LLM according to the prompt data;

[0035] step S505: semantically checking the code snippet by the inference module 11 for determining if the code snippet is successfully verified, if yes, entering step S506, else, entering step S510;

[0036] step S506: compiling the code snippet and executing the code snippet under the product 15;

[0037] step S507: analyzing the execution result corresponding to the code snippet after the code snippet is executed under the product 15;

[0038] step S508: comparing the execution result corresponding to the code snippet with the at least one constraint of the product 15 by the profiling module 12 for determining if the code snippet matches the at least one constraint, if yes, entering step S509, else, entering step S510;

[0039] step S509: adding the code snippet to the testing benchmark data of the testing benchmark generation module 14.

[0040] step S510: adjusting the prompt data according to the at least one prompt constraint and entering step S503;

[0041] step S511: terminating the process.

[0042] In step S501, the testing benchmark generation system 100 can set a maximum number of code snippets. Then, in step S502, the amount of testing snippets can be compared with the maximum number of code snippets for determining if the amount of testing snippets has reached than the maximum number of code snippets. If the amount of testing snippets has reached the maximum number of code snippets, it implies the process is completed. Therefore, in step S511, the testing benchmark generation process is terminated. If the amount of testing snippets is smaller than the maximum number of code snippets, then in step S503, the prompt data of the product 15 can be generated by the prompt generation module 10. In step S504, the code snippet can be generated by the LLM according to the prompt data. In step S505, the inference module 11 semantically checks the code snippet for determining if the code snippet is successfully verified. If semantics of the code snippet is successfully verified, step S506 can be performed. If the semantic verification of the code snippet fails, it implies that the code snippet is invalid or inappropriate. Therefore, in step S510, the prompt adjustment module 13 can adjust the prompt data according to the at least one constraint and re-enters step S503. Therefore, the prompt data can be updated by the prompt generation module 10. In step S506, the code snippet can be compiled and executed under the product 15. In step S507, the profiling module 12 can analyze the execution result corresponding to the code snippet after the code snippet is executed under the product 15. In step S508, the profiling module 12 can compare the execution result corresponding to the code snippet with the at least one constraint of the product 15 for determining if the code snippet matches the at least one constraint. In the code snippet matches the at least one constraint according to the execution result, it implies that the code snippet can be introduced to the testing benchmark data. Therefore, in step S509, the code snippet can be added to the testing benchmark data of the testing benchmark generation module 14. If the code snippet and the at least one constraint are mismatched, then in step S510, the prompt adjustment module 13 can adjust the prompt data according to the at least one constraint and re-enters step S503. Therefore, the prompt data can be updated by the prompt generation module 10. In the testing benchmark generation system 100, by using a two-step verification mechanism (i.e., step S505 and step S508), since the prompt data can be dynamically adjusted, the code snippet can be optimized. Since the “optimized” code snippet can be added to the testing benchmark data of the testing benchmark generation module 14 in each processing loop, the testing benchmark data can be generated by the testing benchmark generation module 14 according to a plurality of “optimized” code snippets.

[0043] In the testing benchmark generation system 100, any technology modification falls into the scope of the present invention. For example, the prompt adjustment module 13 can “automatically” adjust the prompt data. The testing benchmark generation system 100 can set a maximum number of adjusting the prompt data. Then, an amount of adjusting the prompt data can be compared with the maximum number of adjusting the prompt data. If the amount of adjusting the prompt data reaches the maximum number of adjusting the prompt data, it implies that current prompt data cannot be adjusted automatically. Therefore, the prompt generation module 10 can be reset for generating the prompt data.

[0044] To sum up, the present invention discloses a testing benchmark generation method and a testing benchmark generation system. The testing benchmark generation system can systematically generate optimal testing benchmark data by dynamically adjusting the prompt data. Further, the testing benchmark generation system can use the two-step verification mechanism for filtering out inappropriate code snippets. Therefore, the testing benchmark data generated by the testing benchmark generation system can be used for applying to various hardware and software architectures.

[0045] The foregoing outlines the features of several embodiments, enabling those skilled in the art to fully appreciate the aspects of the present disclosure. Those skilled in the art should recognize that the present disclosure provides a foundation for designing or modifying other processes and structures to achieve substantially the same functions and / or substantially the same results as those of the embodiments introduced herein. Furthermore, such equivalent arrangements do not deviate from the spirit and scope of the present disclosure, and various changes, substitutions, and alterations may be made without so departing.

Claims

1. A testing benchmark generation method for a product, comprising:generating prompt data according to at least one constraint of the product;generating, by a large language model (LLM), a candidate code snippet according to the prompt data;executing the candidate code snippet under the product to obtain an execution result;determining, based on a comparison of the execution result with the at least one constraint, whether the candidate code snippet matches the at least one constraint; andin response to determining that the candidate code snippet matches the at least one constraint, adding the candidate code snippet to testing benchmark data.

2. The method of claim 1, further comprising performing an architecture analysis of the product before generating the prompt data, wherein determining whether the candidate code snippet matches the at least one constraint comprises analyzing the execution result by a profiling tool.

3. The method of claim 1, wherein the prompt data is generated according to task description data, code snippet format data, constraint data, and few-shot learning data.

4. The method of claim 1, further comprising:semantically checking the candidate code snippet to determine whether the candidate code snippet is successfully verified; andcompiling the candidate code snippet in response to determining that the candidate code snippet is successfully verified, wherein executing the candidate code snippet is performed after the candidate code snippet is compiled.

5. The method of claim 4, wherein semantically checking the candidate code snippet comprises:checking whether a code semantics format of the candidate code snippet satisfies a designated programming language; andacquiring a check result of the code semantics format to determine whether the candidate code snippet is successfully verified.

6. The method of claim 4, further comprising, in response to determining, based on the semantic checking, that the candidate code snippet is not successfully verified: adjusting the prompt data according to the at least one constraint; andgenerating, by the LLM, an updated candidate code snippet according to the adjusted prompt data.

7. The method of claim 1, further comprising, in response to determining that the candidate code snippet does not match the at least one constraint:adjusting the prompt data according to the at least one constraint; andgenerating, by the LLM, an updated candidate code snippet according to the adjusted prompt data.

8. The method of claim 1, wherein generating the candidate code snippet, executing the candidate code snippet, determining whether the candidate code snippet matches the at least one constraint, and adding the candidate code snippet are iteratively performed for a plurality of candidate code snippets, and wherein each of the plurality of candidate code snippets corresponds to a respective testing item of the product.

9. The method of claim 8, further comprising:setting a maximum number of candidate code snippets;comparing a number of candidate code snippets added to the testing benchmark data with the maximum number; andterminating generation of the testing benchmark data in response to the number reaching the maximum number.

10. The method of claim 1, wherein:when the product comprises a hardware product, the testing benchmark data is used for profiling hardware performance; andwhen the product comprises a software product, the testing benchmark data is used for testing robustness of a compiler corresponding to the software product.

11. A testing benchmark generation system for a product, comprising:a prompt generation module configured to generate prompt data according to at least one constraint of the product;an inference module coupled to the prompt generation module and configured to generate, by a large language model (LLM), a candidate code snippet according to the prompt data and execute the candidate code snippet under the product to obtain an execution result;a profiling module coupled to the inference module and configured to determine, based on a comparison of the execution result with the at least one constraint, whether the candidate code snippet matches the at least one constraint; anda testing benchmark generation module coupled to the profiling module and comprising a memory, wherein the testing benchmark generation module is configured to store the candidate code snippet in the memory as part of testing benchmark data in response to the profiling module determining that the candidate code snippet matches the at least one constraint.

12. The system of claim 11, wherein the prompt generation module is configured to perform an architecture analysis of the product before generating the prompt data, and the profiling module is configured to analyze the execution result by a profiling tool.

13. The system of claim 11, wherein the prompt data is generated according to task description data, code snippet format data, constraint data, and few-shot learning data.

14. The system of claim 11, wherein the inference module is further configured to:semantically check the candidate code snippet to determine whether the candidate code snippet is successfully verified;compile the candidate code snippet in response to determining that the candidate code snippet is successfully verified; andexecute the candidate code snippet after the candidate code snippet is compiled.

15. The system of claim 14, wherein the inference module is configured to semantically check the candidate code snippet by:checking whether a code semantics format of the candidate code snippet satisfies a designated programming language; andacquiring a check result of the code semantics format to determine whether the candidate code snippet is successfully verified.

16. The system of claim 14, further comprising a prompt adjustment module coupled to the inference module and configured, in response to the inference module determining that the candidate code snippet is not successfully verified, to adjust the prompt data according to the at least one constraint, wherein the inference module is further configured to generate, by the LLM, an updated candidate code snippet according to the adjusted prompt data.

17. The system of claim 11, further comprising a prompt adjustment module coupled to the profiling module and configured, in response to the profiling module determining that the candidate code snippet does not match the at least one constraint, to adjust the prompt data according to the at least one constraint, wherein the inference module is further configured to generate, by the LLM, an updated candidate code snippet according to the adjusted prompt data.

18. The system of claim 11, wherein the inference module, the profiling module, and the testing benchmark generation module are configured to iteratively process a plurality of candidate code snippets, and each of the plurality of candidate code snippets corresponds to a respective testing item of the product.

19. The system of claim 18, wherein the system is further configured to:set a maximum number of candidate code snippets;compare a number of candidate code snippets stored as part of the testing benchmark data with the maximum number; andterminate generation of the testing benchmark data in response to the number reaching the maximum number.

20. The system of claim 11, wherein:when the product comprises a hardware product, the testing benchmark data is used for profiling hardware performance; andwhen the product comprises a software product, the testing benchmark data is used for testing robustness of a compiler corresponding to the software product.