IP Library Granted Patent US 12688025
Granted Patent B2
US 12688025 · App. 18/466,287 · Granted Jul 21, 2026

Actor-critique code-to-code translation

Inventors: Dinesh Khandelwal (Indore, IN); Varad Bhatnagar (Bangalore, IN); Saswati Dana (Bangalore, IN); Amar Prakash Azad (Bangalore, IN); Dinesh Garg (Beawar, IN)
Assignee: International Business Machines Corporation
G06F8/51G06F8/313
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12688025
App. No.
18/466,287
Granted
Jul 21, 2026
Kind
B2
Abstract

Methods and systems of translation include performing a search of translation hypotheses for input source code in a first programming language to a second programming language. A constraint is extracted from the input source code. The constraint is applied to the translation hypotheses to generate a source code output in the second programming language.

Claims (31)

1 . A computer-implemented method for translation, comprising:

performing a beam search of translation hypotheses for input source code in a first programming language to a second programming language;

extracting a constraint from the input source code; and

applying the constraint to the translation hypotheses, after a number of hypotheses are selected for consideration in a next iteration of the beam search, to generate a source code output in the second programming language.

2 . The method of claim 1 , wherein applying the constraint includes filtering a set of complete hypotheses generated by the search.

3 . The method of claim 1 , wherein applying the constraint includes limiting branches taken by the search according to the constraint.

4 . The method of claim 1 , wherein the beam search uses a translation model to generate the translation hypotheses.

5 . The method of claim 4 , wherein the constraint is applied before a number of hypotheses are selected for consideration in a next iteration of the beam search, and the number of hypotheses is determined by a beam width.

6 . The method of claim 4 , wherein the number of hypotheses is a beam width, reduced by a number of pruned hypotheses.

7 . The method of claim 6 , wherein a number of additional hypotheses are selected responsive to the number of pruned hypotheses exceeding a threshold value.

8 . The method of claim 4 , wherein the constraint is applied before a number of hypotheses are selected for consideration in a next iteration of the beam search, such that the number of hypotheses is maintained at a beam width.

9 . The method of claim 1 , wherein the constraint is selected from the group consisting of a number of variables in the output source code being the same as a number of variables in the input source code, names of variables in the output source code being the same as variables in the input source code, and data types of variables in the output source code being the same as variables in the input source code.

10 . The method of claim 1 , further comprising compiling or executing the source code output.

11 . A computer program product for translation, the computer program product comprising a computer readable storage medium having program instructions embodied therewith, the program instructions being executable by a hardware processor to cause the hardware processor to:

perform a beam search of translation hypotheses for input source code in a first programming language to a second programming language;

extract a constraint from the input source code; and

apply the constraint to the translation hypotheses, after a number of hypotheses are selected for consideration in a next iteration of the beam search, to generate a source code output in the second programming language.

12 . A system for translation, comprising:

a hardware processor; and

a memory that stores a computer program which, when executed by the hardware processor, causes the hardware processor to:

perform a beam search of translation hypotheses for input source code in a first programming language to a second programming language;

extract a constraint from the input source code; and

apply the constraint to the translation hypotheses, after a number of hypotheses are selected for consideration in a next iteration of the beam search, to generate a source code output in the second programming language.

13 . The system of claim 12 , wherein the constraint filters a set of complete hypotheses generated by the search.

14 . The system of claim 12 , wherein the constraint limits branches taken by the search according to the constraint.

15 . The system of claim 12 , wherein the beam search uses a translation model to generate the translation hypotheses.

16 . The system of claim 15 , wherein the constraint is applied before a number of hypotheses are selected for consideration in a next iteration of the beam search, and the number of hypotheses is determined by a beam width.

17 . The system of claim 15 , wherein the number of hypotheses is a beam width, reduced by a number of pruned hypotheses.

18 . The system of claim 17 , wherein a number of additional hypotheses are selected responsive to the number of pruned hypotheses exceeding a threshold value.

19 . The system of claim 15 , wherein the constraint is applied before a number of hypotheses are selected for consideration in a next iteration of the beam search, such that the number of hypotheses is maintained at a beam width.

20 . The system of claim 12 , wherein the constraint is selected from the group consisting of a number of variables in the output source code being the same as a number of variables in the input source code, names of variables in the output source code being the same as variables in the input source code, and data types of variables in the output source code being the same as variables in the input source code.