Possible overfitting with "TransCoder_model_1.pth" from Java -> Python
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Domain
- compilers, machine-learning
Research direction
Reproduce the report with the pretrained TransCoder_model_1.pth model from the documentation, starting with COUNT_OF_PAIRS_SATISFYING_THE_GIVEN_CONDITION.java and its syntax variations generated by MuJava. Compare the original and modified translations, then determine whether the repeated result-expression error is overfitting; done means establishing the cause and an actionable correction or evaluation finding.
Written by the indexing model from the issue text.
Description
I have been using TransCoder for a few research papers lately and I came across an interesting phenomenon using the pretrained model "TransCoder_model_1.pth" you provide in your docs.
For the program in your dataset COUNT_OF_PAIRS_SATISFYING_THE_GIVEN_CONDITION.java when translated to Python, it passes all test cases. We checked and the translation seems correct. However, when we perform any small syntactical change to the original Java code and try to translate again, the translation mismatches the changed program.
For example, we introduced a change to the following Java code by modifying s.charAt(i) -> s.charAt(++i) at line 5:
static int f_gold( int a, int b ) {
java.lang.String s = String.valueOf( b );
int i;
for (i = 0; i < s.length(); i++) {
if (s.charAt( ++i ) != '9') {
break;
}
}
int result;
if (i == s.length()) {
result = a * s.length();
} else {
result = a * (s.length() - 1);
}
return result;
}
The translated code is as follows:
def f_gold(cls, a, b):
""" generated source for method f_gold """
s = String.valueOf(b)
i = int()
while i < len(s):
i += 1
if s.charAt(i) != '9':
break
i += 1
result = int()
if i == len(s):
result = a * len(s)
else:
result = a * (1 - len(s))
return result
Notice that the changed code is rightfully translated, however, result = a * (s.length() - 1); is now wrongfully translated to result = a * (1 - len(s)).
We have generated 89 variations of this Java function using MuJava, and this translation bug appears in every single one of them, except the original program.
Maybe this is an overfitting example. What are your thoughts?
- Dominant language
- Python
- Stars
- 777
- Forks
- 144
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from facebookresearch/CodeGen
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
facebookresearch/CodeGen#109 ·
-
Hash function Open
Difficulty 3/5 1-2 days Newbie friendliness 42/100
facebookresearch/CodeGen#108 ·
-
Dataset issues Open
Difficulty 3/5 1-2 days Newbie friendliness 45/100
facebookresearch/CodeGen#107 ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
facebookresearch/CodeGen#106 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
facebookresearch/CodeGen#105 ·
All issues in facebookresearch/CodeGen
Similar issues
-
triage/confirmed
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
agentscope-ai/agentscope#2775 ·
-
comp/desktop P3 type/bug
Difficulty 1/5 Under an hour Newbie friendliness 92/100
NousResearch/hermes-agent#118866 ·
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 90/100
apache/cloudstack#14222 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100