Datasets:
Question about the Code Translation dataset
Great job on collecting all this code!
On the code translation dataset, I was sort of expecting Code pairs (Code LanguageX - Code Language Y, where both these codes do equivalent tasks in X and Y) but the dataset puzzles me a little.
Are we supposed to link these pairs using the src_uid?
I tried checking the code translation parts of the paper, but I couldn't figure it out myself.
Hey @Banana-Leopard ! Thanks for the comment. Actually the code-translation dataset is structured in this way because of few reasons,
Reducing the amount of redundant information: There are 11 programming languages in xCodeEval. So, the potential number of pairs is 10*11/2, which is quite large. Providing a linear structure in xCodeEval avoids adding redundent information. The dataset is already very large.
Matching Algorithms: All the parallel codes come from 7514 problems, and for each problem, we have thousands of solutions. We define two codes as parallel if they come from the same problem. Let's assume that for each problem, you have P_1, P_2, .... P_7514 number of codes in Python, and C_1, C_2, .... C_7514 number of codes in C++ language. Now, you can have P_1C_1, P_2C_2, ... P_7514*C_7514 pairs for Python-C language, creating an extremely large number of samples. To filter out language pairs, you can use many different types of matching algorithms. One trivial way is to take random pairs, and another potential way is to use a retrieval model (check out some of the models we trained here) to select the pairing. You can also use/train some kind of AST parser to match the codes. There is a lots of research potential in this direction, which is why we didn't provide any matching pairs.
So, how to perform the simplest pairing, selecting random pairs:
src_uid
defines the problem identifier. Group all training data using src_uid, and let's assume they are G_1, G_2, ... G_k.Each of these G1, G2, ... G_k groups contains code from 11 different languages, and they are parallel to each other. Now, group all of these samples by languages, meaning G1 group will have 11 groups based on 11 different languages, similarly G1, G2, ...., G_k.
Let's assume G1's group names are lang_1, lang_2, ... lang_11. If you want to have a pair from a languages lang_1 and lang_2, take a random sample from lang_1 group and lang_2 group. That's all; they are your paired language samples, ready to train in a seq2seq model.
Please let us know if you have any confusion.