Program Translation Correspondence via Latent-Space Token Encodings
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Deep learning and autoregressive techniques for translating programs between programming languages often result in inaccuracies, making it difficult for human programmers to establish correspondences between the translated and original versions due to differences in syntax and terminology.
Innovation Solution
A computer-implemented method that encodes source and target tokens into a high-dimensional latent space, calculating distances using Euclidean or Cosine similarity functions to identify corresponding tokens, and visually highlighting these correspondences for easy identification.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If deep learning and autoregressive techniques are used for translation, then translation capability is improved, but correspondence identification difficulty increases
Solution Approach 1:
The patent introduces an intermediary correspondence identification module that uses encoding vectors and similarity calculation to bridge the gap between source and target programs. This mediator translates the abstract relationship between code elements into concrete, identifiable correspondences, resolving the difficulty caused by direct translation without structural preservation.
Solution Approach 2:
The patent replaces manual mechanical inspection of translated code with an automated computational system. The system uses encoding vectors, similarity functions (cosine similarity, Euclidean distance), and automated correspondence identification to substitute the manual process of comparing and identifying correspondences between source and target programs.
2Measurement precision
If manual inspection is used to verify translation, then translation accuracy can be assessed, but time consumption increases
Solution Approach 1:
The patent enables the translation system to self-evaluate its output by automatically identifying correspondences between source and target programs. The system uses its own encoding vectors and similarity calculation mechanisms to assess translation quality without requiring external human inspection, thus reducing time consumption while maintaining accuracy assessment capability.
Solution Approach 2:
The patent implements a feedback mechanism where the correspondence identification results are used to evaluate translation quality. The system calculates similarity scores and identifies correspondences automatically, providing immediate feedback on translation accuracy without requiring manual review, thereby reducing time consumption while maintaining measurement precision.
3Adaptability or versatility
If syntax and terminology differences are accommodated, then translation versatility is improved, but correspondence tracking precision decreases
Solution Approach 1:
The patent transforms the correspondence tracking problem from a syntax-based matching task to a vector-space similarity task. By changing the parameter space from discrete syntax elements to continuous encoding vectors, the system can accommodate syntax and terminology differences while maintaining precision through similarity calculation rather than exact matching.
Solution Approach 2:
The patent applies local quality by treating each code element individually with its own encoding vector, allowing different parts of the program to be compared using their specific semantic representations rather than requiring uniform syntax. This enables versatile translation across different languages while maintaining precise correspondence tracking through localized vector comparisons.
Data Source
AI summary
Computer-implemented methods for determining and displaying correspondence between source data and target data. Aspects include receiving source tokens associated with source data and target tokens associated with target data, generating source encodings for each source token of the set of source tokens, and generating target encodings for each target token of the set of target tokens. Aspects include receiving an indication of a selected source token associated with the source data. Aspects further include determining an identified target token from the set of target tokens corresponding to the selected source token by calculating distances between the selected source token and each of the target tokens in the high-dimensional latent space using the source encodings and the target encodings. Aspects include displaying a correspondence between a portion of the source data corresponding to the selected source token and a portion of the target data associated with the identified target token.


