Codex not working properly

For some reason, the code completions given by “code_davinci_002” are significantly worse than the ones given by “text_davinci_002”. I am using the default settings for both of them.

Here is an example:

query to text_davinci_002: “write a find the smallest element within two lists in java”


public static int getMin(int array1, int array2) {
int min1 = array1[0];
int min2 = array2[0];

for (int i = 1; i < array1.length; i++) {
    if (array1[i] < min1) {
        min1 = array1[i];
for (int j = 1; j < array2.length; j++) {
    if (array2[j] < min2) {
        min2 = array2[j];

return Math.min(min1, min2);


But when I provide this same prompt to code_davinci_002, it malfunctions and just repeats the prompt over and over again. This example is not an isolated incident as I am experiencing this problem for most prompts I provide. However, the javascript sandbox works very well for me so I am pretty sure I am doing something wrong with the settings.

Can anyone give any suggestions?

Codex works really good, but it does have a problem with knowing when to stop :slight_smile: You definitely need to use the stop tokens for this, and the prompts are not quite the same

here are some ideas on how to avoid that problem :slight_smile:

Thank you! I realized that I have to use comments instead of just raw text :sweat_smile:. Silly me!