Best AI for coding / head-to-head

Gemini 3.1 Pro Preview vs GPT-5.6 Lunafor coding

The verdict

GPT-5.6 Luna wins, 9388

Same 18 coding tasks, marked blind by three rival labs. GPT-5.6 Luna took 9 tasks, Gemini 3.1 Pro Preview took 2, 7 tied. Tested 16 Aug 2026.

Where they differed most

The task — Callback to async

Refactor this to async/await with correct error propagation. Errors must not be swallowed. getUser(id, (e, user) => { if (e) return cb(e); getOrders(user.id, (e2, orders) => { if (e2) return cb(e2); getTotals(orders, (e3, totals) => cb(e3, totals)); }); });

Here are the two best ways to refactor this, depending on whether you want to completely modernize the function to return a Promise, or if you need to maintain the original callback (`cb`) signature for backwards compatibility.

### Option 1: Pure `async/await` (Recommended)
If you are updating the surrounding code to support Promises, you can drop the callback entirely. In an `async` function, if any `await`ed Promise rejects, the error automatically bubbles up and rejects the returned Promise. **No errors are swallowed.**

```javascript
async…
If the functions return promises:

```js
async function getUserTotals(id) {
  const user = await getUser(id);
  const orders = await getOrders(user.id);
  return getTotals(orders);
}
```

Any error from `getUser`, `getOrders`, or `getTotals` automatically propagates as a rejected promise:

```js
try {
  const totals = await getUserTotals(id);
  console.log(totals);
} catch (err) {
  console.error(err);
}
```

If the existing functions are callback-based, promisify them first:

```js
const { promisify } = require("node:util");

const getUserAsyn…

Task by task

TaskGemini 3.1 Pro PreviewGPT-5.6 Luna
Duration parser89
Find the bug910
SQL without window functions1010
Infinite useEffect89
Typed debounce910
Leftmost binary search910
Security review99
Safe migration88
Fix the code not the test1010
Race condition910
Retry with backoff99
Recursive type109
Bash one-liner89
Explain and cost109
Regex with limits88
Callback to async810
Diagnose from a trace88
Idempotency810

Full receipts: Gemini 3.1 Pro Preview, GPT-5.6 Luna · judges claude-sonnet-5, gpt-5.6-terra, grok-4.5

Questions people ask

Which is better for coding: Gemini 3.1 Pro Preview or GPT-5.6 Luna?

GPT-5.6 Luna — it scored 93/100 against 88/100 on our 18-task coding suite, winning 9 tasks to 2 with 7 tied. Every answer was marked blind by three judges from three rival AI labs.

How was this tested?

Both models answered the identical published coding tasks. Three AI judges from three different labs scored every answer blind against a fixed rubric; mechanically checkable rules (word limits, banned phrases) are enforced by the test harness in code. The raw outputs and judge verdicts are downloadable.

More coding head-to-heads: GPT-5.6 Luna vs GPT-5.6 Sol · GPT-5.6 Luna vs GPT-5.6 Terra · GLM 5.2 vs GPT-5.6 Luna · GPT-5.3-Codex vs GPT-5.6 Luna · GPT-5.5 vs GPT-5.6 Luna · GPT-5.6 Luna vs Qwen3.7 Max

Full ranking: Best AI for coding · model pages: Gemini 3.1 Pro Preview, GPT-5.6 Luna