LLMs

GLM-5.4 Brings Feedback Loops to Coding Agents

GLM-5.4 introduces a loop transformer that repeatedly revises code based on execution feedback. The design raises practical questions about cost, convergence, validation, and auditability in real repositories.

Font size

Zhipu has released GLM-5.4, adding a loop transformer to its general-purpose coding workflow. The important change is not that it generates more code, but that it repeatedly revises that code in response to test results.

Official announcement: https://z.ai/blog/glm-5.4

The launch earned 893 points and 308 comments on Hacker News. Discussion: https://news.ycombinator.com/item?id=50609685

What Makes This the First “Loop Transformer”

The workflow for a conventional coding model is short:

Prompt → one-shot code → human review

A single-turn tool-calling Agent is somewhat more capable:

Prompt → generate code → call tool once → return result

A loop transformer aims to do this instead:

Prompt → generate code → execute → read feedback → revise → execute again
                     ↑                    ↓
                     └────────────────────┘

The difference is not simply whether the model can run commands. It is whether feedback becomes part of the next generation. After a test fails, the model receives not a natural-language summary but the actual error, stack trace, lint output, or compiler log. Those results become context for the next iteration.

The model can then decide which line to change and whether to roll back part of the previous revision.

This changes what the model has to learn. Single-turn generation primarily fits the shape of code found in a repository. Looped programming requires it to model a much longer causal chain:

  1. Which requirements map to which files?
  2. Why did the changes fail?
  3. Did the failure come from the implementation, the environment, or the test itself?
  4. What should the next revision keep, and what should it roll back?

GLM-5.4 is therefore less about “writing more code in one pass” than about putting validation into the general-purpose coding path. For an Agent, tool output is not an attachment; it is the next input for correcting the code.

What Developers Are Arguing About Behind 893 Points

The 893 points and 308 comments on Hacker News show that interest extends beyond benchmark results. Before coding models can work in real repositories, their cost model has to hold up.

Suppose one loop contains six generations, with every prompt carrying repository context, patches, and test logs. Token usage will not scale linearly with the number of responses. Developers will want to know:

  • How many iterations does a task take on average?
  • After a failure, should the Agent retry, change strategy, or expand the context?
  • Should every iteration run the full test suite, or should it start with the smallest relevant test set?
  • If the per-token price falls, could the increase in iterations cancel out the savings?

The second issue is convergence. After seeing a failure log, a model may repeatedly modify the same condition. It may also delete assertions or relax constraints to make the tests pass. A loop transformer provides a mechanism for correction, but it does not automatically guarantee that corrections move in the right direction.

The third issue is localization. In a monolithic project, an interface error can usually be traced to a file through a stack trace. A real repository may contain multiple services, generated code, legacy dependencies, and differing environments. The model must fix the error in the right module rather than make a plausible-looking change in a neighboring file.

Another practical concern in the HN discussion is auditability. Developers need to know which commands, tests, and manual checks the patch went through. Looking only at the final diff does not reveal whether the model fixed the problem or merely tailored the code to satisfy the tests.

Coding Agents’ Bottleneck Is Shifting from Generation to Validation

Writing code quickly does not mean a feature is ready to ship.

Historically, the main constraint in generative coding was the speed of manual work: reading requirements, filling in functions, and handling TODOs. Once models compress that work, the constraint moves to validation. Are the tests trustworthy? Can the environment be reproduced? Are the lint rules correct? Is the failure log clear enough? Is rollback straightforward?

This explains why a loop transformer matters more than “another 500 lines of code.” For an API change, generation may account for only 30 percent of the work. The remaining 70 percent may involve:

pytest -q tests/test_orders.py
ruff check src tests
mypy src

If these commands do not run reliably, an Agent’s loop is merely amplifying noise. If a test environment lacks a database container, the model may blame the business code. If CI depends on a set of prerelease services, a fix that works locally may fail to reproduce in the pipeline.

A reliable coding Agent therefore needs to answer at least four questions:

  1. Is validation reproducible? Does the same commit produce the same result in the same environment?
  2. Can feedback be localized? Can the error be mapped to a specific file and code path?
  3. Does the loop have a budget? How many retries are allowed before control passes to a human?
  4. Can the result be rolled back? Can the Agent retain only the patch that passes validation?

There is a counterintuitive point here: passing tests is not itself a completion signal. The tests may have gaps. A loop transformer makes an Agent better at passing tests, but it does not automatically make the tests complete. The quality of the validation infrastructure determines the ceiling of the loop.

From One-Shot Patches to Continuous Revision

Suppose a team wants to add POST /api/orders/refunds to an order API. Two rules accompany the requirement: a refund cannot exceed the original order amount, and duplicate requests must not issue duplicate refunds.

Traditional one-shot generation usually follows this sequence:

  1. The model reads the requirements and existing routes.
  2. It generates the handler, DTO, database operations, and tests.
  3. A human runs the tests.
  4. A human pastes the errors back into the model.
  5. The model generates another patch.

A loop-based Agent can instead break the task into a tighter feedback cycle:

1. Locate routes, service, model, migration, and test directories
2. Generate a minimal implementation and boundary-condition tests
3. Run only the refund-related tests
4. Read failed assertions and stack traces
5. Keep useful changes and revert local patches that cause regressions
6. Run related tests, then lint / type check
7. Inspect the diff and submit a candidate patch once the budget is met

A failed attempt no longer means “send the same prompt again.” A better approach records state:

attempt 1: implement basic refund logic
attempt 2: fix assertion failure caused by amount precision
attempt 3: add request_id idempotency check
attempt 4: apply lint fixes without changing business logic

Manual review also moves earlier. Developers do not need to inspect every generated line, but they should review three categories: business invariants, database write ordering, and external side effects. Tests, logs, and each iteration’s diff can be generated automatically, but a human still has to approve the final merge.

What really affects efficiency is not whether the model “knows how to retry,” but whether the Agent preserves its failure history. It needs to distinguish whether a second failure provides new evidence about the first failure or is simply environmental noise. Otherwise, longer loops produce dirtier context and slower fixes.

Editorial Take

This matters not merely because coding models have gained another architecture. By turning execution results directly into inputs for the next generation, the loop transformer changes the unit of competition for coding Agents from the “single patch” to the “complete repair task.” Model capability is only one part of the equation. Environment stability, test quality, retry budgets, and rollback capabilities will collectively determine whether the loop repairs problems or amplifies noise.

The next round of differentiation is more likely to appear in convergence speed and failure-recovery rates than in the volume of code generated. An Agent that can locate an issue within two iterations, switch strategies proactively, and leave an auditable record may be more useful to a team than a model with a higher one-shot benchmark score.

This release differs from earlier tool-based Agents because the feedback loop is no longer confined to peripheral tools; it has been built into the general-purpose coding path itself. Still, without official data on average iteration counts, token consumption, and success rates across repositories, 893 points demonstrate the intensity of the discussion, not the engineering payoff. That claim still requires validation through publicly available data.

Source: https://z.ai/blog/glm-5.4