Method, system, device and medium for training data construction of geometry problem translator
By acquiring geometric problems and predicate lists described in natural language to construct translation prompts, and using pre-trained models for grammatical and semantic verification, highly accurate formal language training data is generated. This solves the problem of insufficient training data in plane geometry solution systems and realizes the automation and accuracy of geometry problem translators.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HUA DATA TECH (SHANGHAI) CO LTD
- Filing Date
- 2026-05-08
- Publication Date
- 2026-07-10
AI Technical Summary
Existing plane geometry solving systems lack effective training data, resulting in translators generating data with grammatical errors, missing information, or fabricated geometric conditions. Furthermore, the data is too complex for professionals to learn, making it impossible to effectively train the geometry problem translator of the UniGeometry system.
By acquiring geometric problems and predicate lists described in natural language, translation prompt words are constructed and input into a pre-trained language translation model for grammatical and semantic verification. This generates formal language that conforms to grammatical and semantic accuracy, thus constructing training data for a geometric problem translator.
The system achieves automated generation and high accuracy of training data for a geometry problem translator, ensuring the grammatical accuracy of the formal language and the semantic accuracy of the natural language, thus laying the foundation for the accuracy of the translator.
Smart Images

Figure CN122132844B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the fields of mathematics education and artificial intelligence technology, and in particular to a method, system, device and medium for constructing training data for a geometry problem translator. Background Technology
[0002] There are two main approaches to solving plane geometry problems. One approach is based on probabilistic models, such as large language models or multimodal models. Their task is to directly solve mathematical problems, technically by constructing question-and-answer pairs or using reinforcement learning to train the model to complete the entire solution process. However, large model reasoning is inherently a black box, susceptible to illusion problems. It cannot guarantee the rigor of the reasoning paths provided by the model. In mathematics education, the illusion of large models can mislead students' learning.
[0003] Another solution is to solve the reasoning process using a rigorous formal derivation system (or plane geometry system) to ensure the rigor of the derivation. Examples include the general mathematical derivation system Lean4, the AlphaGeometry system for IMO (Mathematical Olympiad) level geometry proofs, and the UniGeometry derivation system tailored for solving plane geometry problems at the junior high school level. The inputs to these systems are domain-specific formal languages, which are often very complex. Non-specialists typically need a significant amount of time to learn and master the model's inputs, and the input process is exceptionally complex.
[0004] For the Lean4 system, in certain mathematical fields such as algebra, some scholars have begun to study formal language translators for geometry problems. The training data largely comes from the large amount of formal language that comes with the Lean4 language. After translating the formal language into natural language using large model techniques, translation pairs that can be used to train the translator can be obtained.
[0005] For formal planar geometry systems, such as AlphaGeometry and UniGeometry, which are not yet widely used, there are currently no effective translators. Since current translators for Lean4 do not support the UniGeometry system, translated data cannot be obtained using existing translators. Meanwhile, existing general-purpose models, unfamiliar with the translation rules of the UniGeometry system, directly synthesize translated data using these models, resulting in numerous grammatical errors (such as incorrect predicate usage and disordered geometric point construction). Even grammatically correct data often contains missing or fabricated geometric conditions. Furthermore, due to the complexity of the UniGeometry system, training professionals to learn the relevant formal language and manually translating related data is extremely time-consuming and labor-intensive.
[0006] Therefore, in order to train geometry problem translators for formal planar geometry systems (such as AlphaGeometry and UniGeometry), it is urgent to solve the problem of generating training data. Summary of the Invention
[0007] The technical problem to be solved by this disclosure is to overcome the deficiency in the prior art of lacking training data for training geometry problem translators for planar geometry systems, and to provide a method, system, device and medium for constructing training data for geometry problem translators.
[0008] This disclosure solves the above-mentioned technical problems through the following technical solution:
[0009] Firstly, a method for constructing training data for a geometry problem translator is provided. The geometry problem translator is used to translate geometry problems described in natural language into formal language descriptions that can be recognized by a plane geometry system. The method for constructing training data includes:
[0010] Get the current input data;
[0011] The current input data includes a geometric problem to be translated described in natural language and translation prompts constructed based on a predicate list, wherein the predicate list is used to describe the language translation rules of the geometric problem in the planar geometry system;
[0012] The current input data is input into a pre-trained language translation model, which outputs the current formal language corresponding to the geometry problem to be translated.
[0013] Perform syntax validation on the current formal language;
[0014] In response to the syntax verification operation of the current formal language, the current natural language corresponding to the current formal language is obtained;
[0015] Perform semantic verification on the current natural language;
[0016] In response to the semantic verification operation of the current natural language, training data for the geometry problem translator is constructed based on the current formal language.
[0017] Optionally, the training data construction method further includes:
[0018] In response to the current formal language failing the syntax verification operation, obtain the syntax verification error data corresponding to the current formal language;
[0019] Wherein, the syntax verification error data includes the syntax verification error data of the current round; or the syntax verification error data includes the syntax verification error data of the current round and the syntax verification error data of the previous rounds;
[0020] The current input data is updated based on the syntax validation error data, and the process returns to the step of obtaining the current input data until the syntax validation operation passes.
[0021] Optionally, the training data construction method further includes:
[0022] In response to the current natural language failing the semantic verification operation, obtain the semantic verification error data corresponding to the current formal language;
[0023] The semantic verification error data includes the semantic verification error data of the current round; or the semantic verification error data includes the semantic verification error data of the current round and the semantic verification error data of the historical rounds.
[0024] The current input data is updated based on the semantic verification error data, and the step of obtaining the current input data is returned until both the syntax verification operation and the semantic verification operation pass.
[0025] Optionally, the step of updating the current input data based on the syntax verification error data includes:
[0026] The current input data is updated using the syntax verification error data, the geometry problem to be translated, and the translation prompts.
[0027] And / or, the step of updating the current input data based on the semantic verification data includes:
[0028] The current input data is updated using the semantic verification error data, the geometry problem to be translated, and the translation prompts.
[0029] Alternatively, the current input data can be updated using the syntax verification error data, the semantic verification error data, the geometry problem to be translated, and the translation prompts.
[0030] Optionally, the step of performing syntax verification on the current formal language includes:
[0031] Determine whether the actual translation format of the current formal language conforms to the preset topic translation format in the predicate list;
[0032] If not, then it is determined that the current formal language has failed the syntax verification operation;
[0033] If so, determine whether the format of each sentence in the actual translation format conforms to the preset sentence translation format in the predicate list;
[0034] If the sentence does not conform to the preset translation format, then the current formal language is determined to have failed the syntax verification operation.
[0035] If the sentence conforms to the preset translation format, then the current formal language is determined to have passed the syntax verification operation.
[0036] Optionally, the step of obtaining the current natural language corresponding to the current formal language includes:
[0037] Obtain the predicate translation template from the predicate table;
[0038] Based on the predicate translation template, the actual conclusion predicate and the actual premise predicate in the actual translation format are translated to obtain the current natural language corresponding to the current formal language.
[0039] Optionally, the step of performing semantic verification on the current natural language includes:
[0040] The current natural language is input into a pre-trained semantic matching model, and the semantic verification result corresponding to the current natural language is output.
[0041] Alternatively, the current natural language can be input into the language translation model, and the semantic verification result corresponding to the current natural language can be output.
[0042] The semantic verification result indicates whether the current natural language passes the semantic verification operation;
[0043] And / or, the step of constructing training data for the geometry problem translator based on the current formal language includes:
[0044] The geometry problem to be translated, the current formal language, and the predicate list are input into a pre-trained learning model, which outputs several thought chains corresponding to the current formal language.
[0045] Based on the language translation model, a consistency analysis operation is performed on each of the thought chains to determine whether the current formal language is consistent with each of the thought chains.
[0046] The consistent thought chain is taken as the target thought chain corresponding to the current formal language;
[0047] The training data for the geometry problem translator is constructed based on the geometry problem to be translated, the current formal language, and the target thought chain.
[0048] Secondly, a training data construction system for a geometry problem translator is provided, wherein the geometry problem translator is used to translate geometry problems described in natural language into formal language descriptions that can be recognized by a plane geometry system, and the training data construction system includes:
[0049] The input data acquisition module is used to acquire the current input data;
[0050] The current input data includes a geometric problem to be translated described in natural language and translation prompts constructed based on a predicate list, wherein the predicate list is used to describe the language translation rules of the geometric problem in the planar geometry system;
[0051] The language translation module is used to input the current input data into a pre-trained language translation model and output the current formal language corresponding to the geometry problem to be translated.
[0052] The syntax verification module is used to perform syntax verification operations on the current formal language.
[0053] The language back-translation module is used to perform a language back-translation operation on the current formal language in response to the syntax verification operation of the current formal language, so as to translate the current natural language corresponding to the current formal language;
[0054] The semantic verification module is used to perform semantic verification operations on the current natural language;
[0055] The training data construction module is used to construct training data for the geometry problem translator based on the current formal language in response to the semantic verification operation of the current natural language.
[0056] Thirdly, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and used to run on the processor, wherein the processor executes the computer program to implement the training data construction method for the geometry problem translator described above.
[0057] Fourthly, a computer-readable storage medium is provided, on which a computer program is stored, wherein the computer program, when executed by a processor, implements the training data construction method for the geometry problem translator described above.
[0058] Based on common knowledge in the field, the above-mentioned preferred conditions can be combined arbitrarily to obtain various preferred embodiments of this disclosure.
[0059] The positive and progressive effects of this disclosure are as follows:
[0060] This disclosure discloses a method, system, device, and medium for constructing training data for a geometry problem translator. It obtains a predicate list of language translation rules describing geometry problems in a planar geometric system, constructs translation prompts based on the predicate list, and inputs current input data, including the geometry problem to be translated in natural language and the translation prompts, into a language translation model to obtain the current formal language corresponding to the geometry problem to be translated. Then, it performs grammatical verification on the current formal language, and if the grammatical verification passes, it performs semantic verification on the corresponding current natural language. If the current natural language passes the semantic verification, it constructs the training data for the geometry problem translator based on the current formal language. Compared to existing methods that directly use the formal language output by a large model as training data, this disclosure achieves automated generation of the current formal language while ensuring the grammatical accuracy of the current formal language and the semantic accuracy of the corresponding current natural language. This results in the current formal language used as training data for the geometry problem translator having extremely high accuracy and reliability, laying a foundation for the accuracy of the geometry problem translator. Attached Figure Description
[0061] Figure 1 A schematic diagram of the first process for constructing training data for a geometry problem translator provided in Embodiment 1 of this disclosure;
[0062] Figure 2 A schematic diagram of the second process for constructing training data for the geometry problem translator provided in Embodiment 1 of this disclosure;
[0063] Figure 3 A schematic diagram of the third process for constructing training data for the geometry problem translator provided in Embodiment 1 of this disclosure;
[0064] Figure 4 A schematic diagram of the graphical relationships of the geometric problems to be translated in the training data construction method of the geometric problem translator provided in Embodiment 1 of this disclosure;
[0065] Figure 5 A schematic diagram of the structure of the training data construction system for the geometry problem translator provided in Embodiment 2 of this disclosure;
[0066] Figure 6 This is a schematic diagram of the structure of the electronic device provided in Embodiment 3 of this disclosure. Detailed Implementation
[0067] The present disclosure is further illustrated below by way of embodiments, but the present disclosure is not limited to the scope of the embodiments described herein.
[0068] The prefixes such as "first" and "second" used in this disclosure are merely for distinguishing different descriptive objects and do not limit the position, order, priority, quantity, or content of the described objects. The use of ordinal numbers and other prefixes used to distinguish descriptive objects in this disclosure does not constitute a limitation on the described objects. The description of the described objects is given in the claims or the context of the embodiments, and should not be construed as an unnecessary limitation. Furthermore, in the description of this embodiment, unless otherwise stated, "multiple" means two or more.
[0069] Example 1
[0070] This embodiment provides a method for constructing training data for a geometry problem translator. The geometry problem translator is used to translate geometry problems described in natural language into formal language descriptions that can be recognized by a plane geometry system, such as... Figure 1 As shown, the training data construction method includes:
[0071] S1. Get the current input data.
[0072] S2. Input the current input data into the pre-trained language translation model and output the current formal language corresponding to the geometry problem to be translated.
[0073] S3. Perform syntax validation on the current formal language.
[0074] S4. In response to the syntax validation operation of the current formal language, obtain the current natural language corresponding to the current formal language.
[0075] S5. Perform semantic verification on the current natural language.
[0076] S6. Training data for a geometry problem translator built based on the current formal language, in response to the semantic verification operation of the current natural language.
[0077] The current input data includes a geometric problem to be translated described in natural language and translation prompts constructed based on a predicate list, which is used to describe the language translation rules for geometric problems in a plane geometry system.
[0078] Specifically, the current input data is the input of the language translation model in this round, and the current formal language is the output of the language translation model in this round. The current input data for this round can be obtained by updating the input data of the previous round. That is, this disclosure can perform several rounds of syntax verification operations and several rounds of semantic verification operations until both syntax verification operations and semantic verification operations pass.
[0079] The training data construction method for the geometry problem translator in this embodiment, compared with the existing method of directly using the formal language output by a large model as training data, not only achieves the automatic generation of the current formal language, but also ensures the grammatical accuracy of the current formal language and the semantic accuracy of the natural language corresponding to the current formal language. This makes the current formal language used as training data for the geometry problem translator have extremely high accuracy and reliability, laying the foundation for the accuracy of the geometry problem translator.
[0080] In an alternative implementation, such as Figure 2 As shown, this training data construction method also includes:
[0081] S71. In response to the current formal language failing syntax validation, obtain the syntax validation error data corresponding to the current formal language.
[0082] S72. Update the current input data based on syntax validation error data.
[0083] If the first round of syntax validation passes directly, there will be no syntax validation error data.
[0084] If the first round of syntax validation fails, a second round of syntax validation will be performed. The error data for the second round of syntax validation will include the error data from the current round. If the second round of syntax validation fails, a third round of syntax validation will be performed. For the third and subsequent rounds of syntax validation, the error data will include the error data from the current round and the error data from previous rounds.
[0085] After executing S72, return to step S1 above until the syntax verification operation passes. That is, update the current input data based on the syntax verification error data, obtain the current input data, input the current input data into the pre-trained language translation model, output the current formal language corresponding to the geometry problem to be translated, and perform syntax verification on the current formal language until the syntax verification operation passes.
[0086] The training data construction method of the geometry problem translator in this embodiment involves updating the current input data based on the syntax verification error data if the current formal language fails the syntax verification operation. The updated current input data is then translated using a language translation model, which is instructed to improve the previous translation errors. This yields the updated current formal language corresponding to the geometry problem to be translated, and the current formal language is then subjected to syntax verification until the syntax verification operation passes. Through multiple rounds of dialogue, the grammatical accuracy of the current formal language is ensured.
[0087] In an alternative implementation, such as Figure 2 As shown, the training data construction method also includes:
[0088] S81. In response to the current natural language failing the semantic verification operation, obtain the semantic verification error data corresponding to the current formal language.
[0089] S82. Update the current input data based on the semantic verification error data.
[0090] If the first round of semantic verification passes directly, there will be no semantic verification error data.
[0091] If the first round of semantic verification fails, a second round of semantic verification will be performed. The error data for the second round of semantic verification includes the error data for the current round. If the second round of semantic verification fails, a third round of semantic verification will be performed. For the third and subsequent rounds of semantic verification, the error data includes the error data for the current round and the error data for previous rounds.
[0092] After executing S82, return to execute the above step S1 until both the syntax verification operation and the semantic verification operation pass.
[0093] The training data construction method for the geometry problem translator in this embodiment performs semantic verification on the corresponding natural language if the current formal language passes the grammatical verification operation. If the current formal language fails the semantic verification operation, the current input data is updated based on the semantic verification error data, and the updated current input data is translated using a language translation model to obtain the updated current formal language corresponding to the geometry problem to be translated. Subsequent operations are then performed until both the grammatical and semantic verification operations pass. Through multi-turn dialogue, the grammatical accuracy of the current formal language and the semantic accuracy of the corresponding natural language are guaranteed.
[0094] In an optional implementation, the step of updating the current input data based on syntax verification error data includes: updating the current input data using syntax verification error data, the geometry problem to be translated, and translation prompts.
[0095] If the current formal language fails the first round of syntax validation, there will be syntax validation error data. The current input data will be updated using the syntax validation error data, the geometry problem to be translated, and the translation prompts.
[0096] In an optional implementation, the step of updating the current input data based on semantic verification error data includes: updating the current input data using semantic verification error data, the geometry problem to be translated, and translation prompts.
[0097] If the current formal language passes the first round of syntax validation, then the current input data is updated using semantic validation error data, the geometry problem to be translated, and translation prompts.
[0098] In an optional implementation, the step of updating the current input data based on semantic verification error data includes: updating the current input data using syntax verification error data, semantic verification error data, the geometry problem to be translated, and translation prompts.
[0099] If the current formal language fails the first round of syntax verification, i.e., two or more rounds of syntax verification have been performed, and there is syntax verification error data, then the current input data will be updated using the syntax verification error data, semantic verification error data, the geometry problem to be translated, and translation prompt words.
[0100] In an alternative implementation, such as Figure 3 As shown, step S3 above includes:
[0101] S31. Determine whether the actual translation format of the current formal language conforms to the preset title translation format in the predicate list.
[0102] If not, proceed to step S32; if yes, proceed to step S33.
[0103] S32. Determine if the current formal language has failed syntax validation.
[0104] S33. Determine whether the format of each sentence in the actual translation format conforms to the preset sentence translation format in the predicate list.
[0105] If not, proceed to step S32; if yes, proceed to step S34.
[0106] S34. Determine if the current formal language passes the syntax verification operation.
[0107] For example, the preset translation format for the question is:
[0108] ``` clause_1; clause_2; ... clause_n ? Conclusion: Point parameters on the predicate graph```;
[0109] Here, clause is a sentence describing the conditions of the problem, clause_1 is the first sentence, and clause_n is the nth sentence. Sentences are described using predicates and parameters. The problem translation is separated by question marks. The content before the question mark is the sentence describing the conditions of the problem, and the content after the question mark describes the problem conclusion. The problem conclusion consists of the conclusion predicate and the point parameters on the graph.
[0110] For example, the preset sentence translation format is:
[0111] `point = construct predicate parameters` or `point1 point2 ... = construct predicate parameters`. In the construction of a sentence, two sets of constructs can be used to obtain a specific point, for example:
[0112] The sentence "a = on_line bc, on_line de;" means that a is the intersection of lines bc and de.
[0113] For example, the geometry problem to be translated is: On line segment ab, c is the midpoint of line segment ab, d is the midpoint of line segment ac, and e is the midpoint of line segment bc. Prove that ad = eb. The actual translation format in the current formal language would be:
[0114] ```ab = segment ab; c = midpoint ab; d = midpoint ac; e =midpoint cb ? cong adeb```.
[0115] First, determine whether the actual translation format of the current formal language conforms to the preset title translation format in the predicate list. If so, determine whether the format of each sentence in the actual translation format conforms to the preset sentence translation format in the predicate list.
[0116] Specifically, based on the predicate list, check whether the constructive and concluding predicates used are in the list; secondly, strictly check whether the usage of "point = constructive predicate parameter" in each clause is correct, and check whether the number of points on the left and right sides of the equal sign conforms to the usage specified in the predicate list. For example, the usage of the predicate "r_segment" is "a = r_segment bcdemn", where r_segment represents a line segment ratio that is constant, and m and n are LaTeX (LaTeX language, a typesetting system based on TeX, a low-level language that computers can process) expressions or numbers.
[0117] For mathematical expressions or numbers, ensure that the parameters (such as m and n above) are in a parsable LaTeX language.
[0118] For other specific formats, such as geoeq_constraint and angeq_constraint, where geoeq_constraint represents the homogeneous equation constraint for the geometric side length and angeq_constraint represents the linear equation for the angle, the parameters should be in JSON (a text format) format.
[0119] Based on the predicate list, for each grammar validation error, such as a predicate not being used in the usage list or a discrepancy in the number of points, detailed grammar validation error data is provided. This data includes: the correct usage of the specified predicate, the current incorrect usage, and the error type (predicate out of range, incorrect number of points on the left side of the equals sign, incorrect number of points on the right side of the equals sign, grammatical error in a specific position, etc.). Specifically, the overall parameter point order in the translated current formal language must satisfy the following requirement: all points on the right side of the equals sign must appear in the sentence on the left side, unless the sentence uses a constructive predicate with the same number of points on both sides of the equals sign, such as the triangle predicate (see the predicate representation example below).
[0120] Below is a simple example of a predicate table, which details the aforementioned preset title translation format and preset sentence translation format, and records the usage of conclusion predicates and construction predicates.
[0121] For example, the usage of conclusion predicates and point parameters on graphs in the preset question translation format is shown in Table 1:
[0122] Table 1
[0123]
[0124] For example, the usage of constructive predicates and parameters in the preset sentence translation format is shown in Tables 2, 3, 4, and 5:
[0125] Table 2 - Basic Graphics
[0126]
[0127] Table 3 - Special Points
[0128]
[0129] Table 4 - Points and Lines
[0130]
[0131] Table 5-Angle
[0132]
[0133] In this context, `\_ = **angeq\_constraint** c0+c1x1+c2x2 {"c0":120,"c1":-1,"c2":-1} {"x1":"abc","x2":"cab"}` represents the angular constraint. The first parameter is the general form of the linear equation (e.g., c0+c1x1+c2x2), the second dictionary is the coefficient dictionary (e.g., {"c0":120,"c1":-1,"c2":-1} represents the constant term 120, x1 coefficient -1, x2 coefficient -1), and the third dictionary is the variable dictionary (e.g., {"x1":"abc","x2":"cab"} represents x1 corresponding to ∠ABC, x2 corresponding to ∠CAB). The constraint equation is: 120-∠ABC-∠CAB=0.
[0134] Where `\_ = **angeq\_constraint** c0+c1x1 {"c0":60,"c1":-1} {"x1":"abc"}` represents a single-angle constraint: 60-∠ABC=0.
[0135] In a specific example, the geometry problem is: On line segment ab, c is the midpoint of line segment ab, d is the midpoint of line segment ac, and e is the midpoint of line segment bc. Prove that ad = eb. Using the language translation model disclosed herein, the translated geometry problem corresponds to the following current formal language:
[0136] `ab = segment ab; c = midpoint ab; d = midpoint ac; e = midpointc b ? cong adeb`.
[0137] In an alternative implementation, such as Figure 3 As shown, step S4 above includes:
[0138] S41. In response to the semantic verification operation of the current formal language, obtain the predicate translation template in the predicate table.
[0139] S42. Based on the predicate translation template, translate the actual conclusion predicate and the actual premise predicate in the actual translation format to obtain the current natural language corresponding to the current formal language.
[0140] Since the current formal language is machine language, a domain-specific language designed for a specific purpose, it is not easily understood by non-specialists. Therefore, a language back-translation operation is needed to translate the current formal language, which has passed semantic verification, into the corresponding natural language. Specifically, based on the predicate translation template in the predicate table, the actual conclusion predicates and actual premise predicates in the actual translation format are translated to obtain the corresponding natural language. Note that the point parameters on the graph in the geometry problem can be modified.
[0141] The current natural language obtained by the language back-flipping operation is not exactly the same as the original proposition (the geometry problem to be translated), but it is mathematically equivalent and easy to understand.
[0142] In an optional implementation, the step of performing semantic verification on the current natural language includes: inputting the current natural language into a pre-trained semantic matching model and outputting the semantic verification result corresponding to the current natural language.
[0143] The semantic verification result indicates whether the current natural language has passed the semantic verification operation.
[0144] In this embodiment, semantic verification is performed using a semantic matching model. This model can be a large language model capable of recognizing written text, or a visual model capable of recognizing both images and text. The language back-flipping operation reduces the difficulty of semantic verification, allowing the semantic matching model to correctly determine the semantics of the translated natural language without needing to know the specific formal language definition.
[0145] In an optional implementation, the step of performing semantic verification on the current natural language includes: inputting the current natural language into the language translation model and outputting the semantic verification result corresponding to the current natural language.
[0146] The semantic verification result indicates whether the current natural language has passed the semantic verification operation.
[0147] In this embodiment, semantic verification is performed using the aforementioned language translation model, which is a visual model capable of recognizing images and text. The design of the language back-flipping operation reduces the difficulty of semantic verification, allowing the language translation model to correctly determine the semantics of the current natural language being translated without needing to know the specific formal language definition.
[0148] In an alternative implementation, such as Figure 3 As shown, step S6 above includes:
[0149] S61. In response to the current natural language, the semantic verification operation is performed, and the geometry problem to be translated, the current formal language, and the predicate list are input into the pre-trained learning model, and the output is several thought chains corresponding to the current formal language.
[0150] S62. Perform consistency analysis on each thought chain based on the language translation model to determine whether the current formal language is consistent with each thought chain.
[0151] S63. Use a consistent thought chain as the target thought chain corresponding to the current formal language.
[0152] S64. Training data for a geometry problem translator is constructed based on the geometry problem to be translated, the current formal language, and the target thought chain.
[0153] For subsequent reinforcement learning, thought chains need to be added to the data. Since the multi-turn dialogue results during data construction are too complex (extremely long), a pre-trained learning model (such as DeepSeek-V3) is used to regenerate the thought chains. Specifically, the geometry problem to be translated, the current formal language, and the predicate list are input into the pre-trained learning model. The model is required to generate a thought chain (thinking process) for translating this formal language, referring to the translation rules in the predicate list. Finally, a language translation model (such as the Doubao large model) is used to perform consistency analysis on the generated thought chains, filtering out consistent thought chains as the target thought chain for the current formal language. The final translation pairs that meet the requirements and include a reasonable thought chain process (geometry problem to be translated - current formal language - target thought chain) are used as training data for subsequent translator training.
[0154] In a specific example, the geometry problem to be translated is: In parallelogram ABCD, E and F are two points on sides BC and CD respectively; connect AE and AF. If AD=5, AB=3, CF=1, ∠AEB=∠AFE=∠EFC, find the length of AF. The given geometric relationships are as follows: Figure 4 As shown:
[0155] Using the language translation model disclosed herein, the above-mentioned geometric problem to be translated is translated, and the corresponding current formal language is obtained as follows:
[0156] `zw = segment zw; dab = triangle dab; c = intersection_pp da bb ad; d = r_segment adzw 5 1; d = r_segment cdzw 3 1; f = s_segment cd 1 3; e = angle_bisector afc, on_line bc; o = circle adf; e = on_circleo a, on_line bc; p = on_line bc, on_line af? rcompute afzw`;
[0157] In this context, semicolons separating phrases like `dab = triangle dab` are clauses. A clause can be a single sentence or a comma-separated sentence like `e = angle_bisector afc, on_line bc`. The predicate before the question mark (?) is the constructive predicate, and the predicate after the question mark (?) is the concluding predicate. For example, `on_line` is the constructive predicate, `rcompute` is the concluding predicate, and `bc` in `on_line bc` is a point parameter. For `d = r_segment cdzw 3 1`, the constructive predicate `r_segment` means `cd / zw = 3`. Here, `r_segment` contains some LaTeX statements (numbers are automatically LaTeX statements).
[0158] Performing a language backflip operation on the current formal language yields the corresponding current natural language:
[0159] DAB forms a triangle. A line parallel to AB is drawn through point D, and a line parallel to AD is drawn through point B, intersecting at point C. DA=5, DC=3. F lies on line segment CD, CF / CD=1 / 3. E lies on the angle bisector of ∠AFC, and point E lies on line BC. O is the circumcenter of △ADF, and point E lies on a circle with center O and radius OA. Point E lies on line BC, point P lies on line BC, and point P lies on line AF. Find the measure of AF.
[0160] It can be seen that the current natural language obtained by the language back-flipping operation disclosed herein, although not exactly the same as the geometry problem to be translated, is mathematically equivalent, highly accurate, and easy to understand.
[0161] Example 2
[0162] Corresponding to the aforementioned embodiment of the training data construction method for a geometry problem translator, this disclosure also provides an embodiment of a training data construction system for a geometry problem translator. The geometry problem translator is used to translate geometry problems described in natural language into formal language descriptions that can be recognized by a plane geometry system, such as... Figure 5 As shown, the training data construction system includes:
[0163] Input data acquisition module 1 is used to acquire the current input data;
[0164] The current input data includes a geometric problem to be translated described in natural language and translation prompts constructed based on a predicate list, which is used to describe the language translation rules of geometric problems in a plane geometry system.
[0165] Language translation module 2 is used to input the current input data into the pre-trained language translation model and output the current formal language corresponding to the geometry problem to be translated;
[0166] Syntax validation module 3 is used to perform syntax validation operations on the current formal language;
[0167] Language back translation module 4 is used to perform a language back translation operation on the current formal language in response to the syntax verification operation of the current formal language, so as to translate the current natural language corresponding to the current formal language;
[0168] Semantic verification module 5 is used to perform semantic verification operations on the current natural language;
[0169] Training data construction module 6 is used to construct training data for a geometry problem translator based on the current formal language through semantic verification operations in response to the current natural language.
[0170] In an optional implementation, the training data construction system further includes:
[0171] The first update module 7 is used to respond to the current formal language failing the syntax validation operation, obtain the syntax validation error data corresponding to the current formal language; update the current input data based on the syntax validation error data, and call the input data acquisition module 1 to obtain the current input data until the syntax validation operation passes.
[0172] The syntax verification error data includes the syntax verification error data of the current round; or the syntax verification error data includes the syntax verification error data of the current round and the syntax verification error data of the previous rounds.
[0173] In an optional implementation, the training data construction system further includes:
[0174] The second update module 8 is used to respond to the current natural language failing the semantic verification operation, obtain the semantic verification error data corresponding to the current formal language; update the current input data based on the semantic verification error data, and call the input data acquisition module 1 to obtain the current input data, until both the syntax verification operation and the semantic verification operation pass.
[0175] The semantic verification error data includes the semantic verification error data of the current round; or the semantic verification error data includes the semantic verification error data of the current round and the semantic verification error data of the historical rounds.
[0176] In an optional implementation, the first update module 7 is used to update the current input data with syntax verification error data, geometry problems to be translated, and translation prompts.
[0177] In an optional implementation, the second update module 8 is used to update the current input data with semantic verification error data, geometry problems to be translated, and translation prompts.
[0178] In an optional implementation, the second update module 8 is used to update the current input data using syntax verification error data, semantic verification error data, geometry problems to be translated, and translation prompts.
[0179] In an optional implementation, the grammar verification module 3 is used to determine whether the actual translation format of the current formal language conforms to the preset title translation format in the predicate list; if not, it is determined that the current formal language has failed the grammar verification operation; if yes, it is determined whether the format of each sentence in the actual translation format conforms to the preset sentence translation format in the predicate list; if it does not conform to the preset sentence translation format, it is determined that the current formal language has failed the grammar verification operation; if it conforms to the preset sentence translation format, it is determined that the current formal language has passed the grammar verification operation.
[0180] In an optional implementation, the semantic verification module 5 is used to input the current natural language into a pre-trained semantic matching model and output the semantic verification result corresponding to the current natural language.
[0181] The semantic verification result indicates whether the current natural language has passed the semantic verification operation.
[0182] In an optional implementation, the semantic verification module 5 is used to input the current natural language into the language translation model and output the semantic verification result corresponding to the current natural language.
[0183] The semantic verification result indicates whether the current natural language has passed the semantic verification operation.
[0184] In an optional implementation, the training data construction module 6 is used to input the geometry problem to be translated, the current formal language, and the predicate list into a pre-trained learning model, and output several thought chains corresponding to the current formal language; perform consistency analysis on each thought chain based on the language translation model to determine whether the current formal language and each thought chain are consistent; take the thought chain with consistency as the target thought chain corresponding to the current formal language; and construct the training data of the geometry problem translator based on the geometry problem to be translated, the current formal language, and the target thought chain.
[0185] The training data construction system for the geometry problem translator in this embodiment obtains a predicate list of language translation rules describing geometry problems in a planar geometry system. Based on the predicate list, translation prompts are constructed. The current input data, including the geometry problem to be translated in natural language and the translation prompts, is input into the language translation model to obtain the current formal language corresponding to the geometry problem to be translated. Then, the current formal language is subjected to grammatical verification. If the grammatical verification passes, the corresponding natural language is subjected to semantic verification. If the natural language passes the semantic verification, the training data for the geometry problem translator is constructed based on the current formal language. Compared with existing methods that directly use the formal language output by a large model as training data, this disclosure achieves both automated generation of the current formal language and ensures the grammatical accuracy of the current formal language and the semantic accuracy of the corresponding natural language. This makes the current formal language used as training data for the geometry problem translator highly accurate and reliable, laying the foundation for the accuracy of the geometry problem translator.
[0186] For the system embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this disclosure according to actual needs.
[0187] Example 3
[0188] Figure 6 This is a schematic diagram of the structure of an electronic device according to an example embodiment of the present disclosure. The electronic device includes a memory, a processor, and a computer program stored in the memory and used to run on the processor. When the processor executes the computer program, it implements the training data construction method for the geometry problem translator provided in Embodiment 1 above. Figure 6The electronic device 90 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments disclosed herein.
[0189] like Figure 6 As shown, the electronic device 90 can be manifested as a general-purpose computing device, such as a server device. The components of the electronic device 90 may include, but are not limited to: at least one processor 91, at least one memory 92, and a bus 93 connecting different system components (including memory 92 and processor 91).
[0190] Bus 93 includes a data bus, an address bus, and a control bus.
[0191] The memory 92 may include volatile memory, such as random access memory (RAM) 921 and / or cache memory 922, and may further include read-only memory (ROM) 923.
[0192] The memory 92 may also include a program tool 925 (or utility) having a set (at least one) program module 924, such program module 924 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment.
[0193] The processor 91 executes various functional applications and data processing by running computer programs stored in the memory 92, such as the training data construction method for the geometry problem translator provided in Embodiment 1 above.
[0194] Electronic device 90 can also communicate with one or more external devices 94 (e.g., keyboard, pointing device, etc.). This communication can be performed through input / output (I / O) interface 95. Furthermore, electronic device 90 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public network, such as the Internet) via network adapter 96. As shown, network adapter 96 communicates with other modules of electronic device 90 via bus 93. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with electronic device 90, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (disk array) systems, tape drives, and data backup storage systems.
[0195] It should be noted that although several units / modules or sub-units / modules of the electronic device have been mentioned in the detailed description above, this division is merely exemplary and not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more units / modules described above can be embodied in one unit / module. Conversely, the features and functions of one unit / module described above can be further divided and embodied by multiple units / modules.
[0196] Example 4
[0197] This disclosure also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the training data construction method for the geometry problem translator provided in Embodiment 1 above.
[0198] The readable storage medium may be more specifically adopted, including but not limited to: portable disk, hard disk, random access memory, read-only memory, erasable programmable read-only memory, optical storage device, magnetic storage device, or any suitable combination thereof.
[0199] Example 5
[0200] This disclosure also provides a computer program product, including a computer program that, when executed by a processor, implements the training data construction method for the geometry problem translator provided in Embodiment 1 above.
[0201] The program code for executing the computer program product of this disclosure can be written in any combination of one or more programming languages, and the program code can be executed entirely on a user device, partially on a user device, as a stand-alone software package, partially on a user device and partially on a remote device, or entirely on a remote device.
[0202] While specific embodiments of this disclosure have been described above, those skilled in the art should understand that these are merely illustrative examples, and the scope of protection of this disclosure is defined by the appended claims. Those skilled in the art can make various changes or modifications to these embodiments without departing from the principles and essence of this disclosure, but all such changes and modifications fall within the scope of protection of this disclosure.
Claims
1. A method for constructing training data for a geometry problem translator, characterized in that, The geometry problem translator is used to translate geometry problems described in natural language into formal language descriptions that can be recognized by a plane geometry system. The training data construction method includes: Get the current input data; The current input data includes a geometric problem to be translated described in natural language and translation prompts constructed based on a predicate list, wherein the predicate list is used to describe the language translation rules of the geometric problem in the planar geometry system; The current input data is input into a pre-trained language translation model, which outputs the current formal language corresponding to the geometry problem to be translated. Perform syntax validation on the current formal language; In response to the syntax verification operation of the current formal language, the current natural language corresponding to the current formal language is obtained; Perform semantic verification on the current natural language; In response to the semantic verification operation of the current natural language, training data for the geometry problem translator is constructed based on the current formal language.
2. The training data construction method according to claim 1, characterized in that, The training data construction method further includes: In response to the current formal language failing the syntax verification operation, obtain the syntax verification error data corresponding to the current formal language; Wherein, the syntax verification error data includes the syntax verification error data of the current round; or the syntax verification error data includes the syntax verification error data of the current round and the syntax verification error data of the previous rounds; The current input data is updated based on the syntax validation error data, and the process returns to the step of obtaining the current input data until the syntax validation operation passes.
3. The training data construction method according to claim 2, characterized in that, The training data construction method further includes: In response to the current natural language failing the semantic verification operation, obtain the semantic verification error data corresponding to the current formal language; The semantic verification error data includes the semantic verification error data of the current round; or the semantic verification error data includes the semantic verification error data of the current round and the semantic verification error data of the historical rounds. The current input data is updated based on the semantic verification error data, and the step of returning to obtain the current input data is executed until both the syntax verification operation and the semantic verification operation pass.
4. The training data construction method according to claim 3, characterized in that, The step of updating the current input data based on the syntax validation error data includes: The current input data is updated using the syntax verification error data, the geometry problem to be translated, and the translation prompts. And / or, the step of updating the current input data based on the semantic verification data includes: The current input data is updated using the semantic verification error data, the geometry problem to be translated, and the translation prompts. Alternatively, the current input data can be updated using the syntax verification error data, the semantic verification error data, the geometry problem to be translated, and the translation prompts.
5. The training data construction method according to claim 1, characterized in that, The steps for performing syntax verification on the current formal language include: Determine whether the actual translation format of the current formal language conforms to the preset topic translation format in the predicate list; If not, then it is determined that the current formal language has failed the syntax verification operation; If so, determine whether the format of each sentence in the actual translation format conforms to the preset sentence translation format in the predicate list; If the sentence does not conform to the preset translation format, then the current formal language is determined to have failed the syntax verification operation. If the sentence conforms to the preset translation format, then the current formal language is determined to have passed the syntax verification operation.
6. The training data construction method according to claim 5, characterized in that, The step of obtaining the current natural language corresponding to the current formal language includes: Obtain the predicate translation template from the predicate table; Based on the predicate translation template, the actual conclusion predicate and the actual premise predicate in the actual translation format are translated to obtain the current natural language corresponding to the current formal language.
7. The training data construction method according to claim 1, characterized in that, The steps for performing semantic verification on the current natural language include: The current natural language is input into a pre-trained semantic matching model, and the semantic verification result corresponding to the current natural language is output. Alternatively, the current natural language can be input into the language translation model, and the semantic verification result corresponding to the current natural language can be output. The semantic verification result indicates whether the current natural language passes the semantic verification operation; And / or, the step of constructing training data for the geometry problem translator based on the current formal language includes: The geometry problem to be translated, the current formal language, and the predicate list are input into a pre-trained learning model, which outputs several thought chains corresponding to the current formal language. Based on the language translation model, a consistency analysis operation is performed on each of the thought chains to determine whether the current formal language is consistent with each of the thought chains. The consistent thought chain is taken as the target thought chain corresponding to the current formal language; The training data for the geometry problem translator is constructed based on the geometry problem to be translated, the current formal language, and the target thought chain.
8. A training data construction system for a geometry problem translator, characterized in that, The geometry problem translator is used to translate geometry problems described in natural language into formal language descriptions that can be recognized by a plane geometry system. The training data construction system includes: The input data acquisition module is used to acquire the current input data; The current input data includes a geometric problem to be translated described in natural language and translation prompts constructed based on a predicate list, wherein the predicate list is used to describe the language translation rules of the geometric problem in the planar geometry system; The language translation module is used to input the current input data into a pre-trained language translation model and output the current formal language corresponding to the geometry problem to be translated. The syntax verification module is used to perform syntax verification operations on the current formal language. The language back-translation module is used to perform a language back-translation operation on the current formal language in response to the syntax verification operation of the current formal language, so as to translate the current natural language corresponding to the current formal language; The semantic verification module is used to perform semantic verification operations on the current natural language; The training data construction module is used to construct training data for the geometry problem translator based on the current formal language in response to the semantic verification operation of the current natural language.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and for running on the processor, characterized in that, When the processor executes the computer program, it implements the training data construction method for the geometry problem translator according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the training data construction method for the geometry problem translator as described in any one of claims 1 to 7.