← Latest papers
💻 computer science

NL2Scratch: An Executable Benchmark and Evaluation for Block-Based Programming

This paper introduces NL2Scratch, a large-scale executable benchmark and the Semantic Alignment Consistency (SAC) metric to address the limitations of conventional NL2Code evaluation in block-based programming, revealing that current LLMs often achieve high lexical similarity while failing to capture the necessary semantic alignment for generating correct Scratch programs.

Original authors: Heejin Do, Alexandre Ballenghien, Yang Wu, April Yi Wang

Published 2026-06-23
📖 4 min read☕ Coffee break read

Original authors: Heejin Do, Alexandre Ballenghien, Yang Wu, April Yi Wang

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are teaching a robot to draw a picture based on your spoken instructions. If you say, "Draw a red circle," the robot needs to understand exactly what "red" and "circle" mean and how to put them together.

This paper is about a new test called NL2Scratch designed to see how well AI can do this, but with a twist: instead of writing text code (like Python), the AI has to build programs using Scratch blocks. Scratch is the colorful, drag-and-drop programming language kids use to make games and animations.

Here is the breakdown of the paper's story, using simple analogies:

1. The Problem: The "Looks Good" Trap

For years, researchers have tested AI on text-based coding. They check if the AI's answer looks similar to the correct answer (like checking if two sentences share the same words).

But Scratch is different. It's like a Lego set.

  • In text coding, if you miss a comma, the whole sentence might break.
  • In Scratch, you can have the right types of blocks (a "move" block, a "repeat" block) and the right words inside them, but if you put them in the wrong order or connect them to the wrong trigger, the game won't work.

The paper argues that current AI tests are like judging a Lego castle just by counting the bricks. If the AI uses the right number of red and blue bricks, the test says "Great job!" even if the castle falls over because the bricks are stacked upside down.

2. The Solution: A New Test and a New Ruler

The authors built NL2Scratch, a massive library of 311,000 examples.

  • The Source: They took real Scratch projects made by humans.
  • The Translation: They used AI to write natural English descriptions for these projects (e.g., "When the green flag is clicked, make the cat move 10 steps").
  • The Filter: They made sure every single example actually works in the Scratch engine.

The New Ruler (SAC):
Instead of just counting matching words, they invented a new measuring stick called Semantic Alignment Consistency (SAC).

  • Think of it like a checklist.
  • Does the description mention the right trigger (like the green flag)?
  • Does it mention the right action (like moving)?
  • Does it have the right numbers (like 10 steps)?
  • SAC checks every single item on this list. If the AI gets the "trigger" right but the "number" wrong, the checklist shows a red X, even if the rest of the sentence looks perfect.

3. The Big Discovery: AI is Good at Mimicry, Bad at Meaning

The researchers tested several smart AI models (like GPT-4 and open-source models) on this new test. Here is what they found:

  • The Illusion of Success: When using old-school tests (counting words), the AI looked amazing. It got 93% to 97% of the words right. It sounded like it knew exactly what to do.
  • The Reality Check: When they used the new SAC checklist, the AI's score dropped dramatically. Only about 18% of the AI's answers were perfectly correct in meaning.
  • The "Long Game" Problem: The longer and more complex the Scratch project was, the worse the AI got at getting the details right, even though it still sounded very similar to the correct answer.

Where did the AI fail?
The AI was great at the "big picture" (knowing it needs a "loop" or a "variable"). But it kept messing up the operational details:

  • It would say "move forward" when it should say "move backward."
  • It would say "repeat 10 times" when it should say "repeat 5 times."
  • It would get the condition wrong (e.g., "if touching the wall" vs. "if touching the cat").

It's like a student who memorized the vocabulary list perfectly but failed the math problem because they added instead of subtracted.

4. The Fix: A "Second Opinion"

The paper also showed that you can use this new checklist (SAC) to fix the AI's mistakes after it generates an answer.

  • Imagine the AI writes 10 different versions of the program.
  • Instead of just picking the first one, you run all 10 through the SAC checklist.
  • You pick the one that matches the checklist best.
  • Result: This simple step improved the AI's accuracy significantly without needing to retrain the AI or teach it anything new.

Summary

The paper concludes that for block-based programming (like Scratch), looking similar isn't enough. An AI can sound like a programmer without actually being one. To truly evaluate AI in this field, we need to check the "gears and wheels" (the specific actions and numbers), not just the "paint job" (the words). They have built the tools to do exactly that.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →