LLM Engineering in Practice: From Code Delivery to Interactive Acceptance
This article presents a practical framework for using large language models in real codebases, covering how to define "done" before letting the model modify code, how to debug build failures with verifiable evidence instead of guesswork, how to validate visual and interactive correctness separately, how to decompose reinforcement learning demos into environment, policy, and presentation layers, and how to turn trial feedback into reusable delivery records with three acceptance gates: buildable, behaviorally correct, and reliably reproducible.
1. Define “Done” Before Letting the Model Touch Code
In a real codebase, the key measure of a large language model is not how quickly it declares a task complete, but whether it can deliver verified changes within existing constraints. A multi-step refactor may involve data structures, business logic, and entry points simultaneously. Even if each piece of code looks reasonable in isolation, inconsistent interface contracts can break the build; and even if the whole project builds, that doesn’t prove existing behavior hasn’t been unintentionally changed.
Before starting a task, answer three questions: Can the current code build and run? Which behaviors should change when the work is done? Which behaviors must stay the same? The first gives you a comparable baseline; the other two define your acceptance cases. For example, when consolidating validation logic from multiple entry points into a shared module, the new behavior could be “all entry points execute the same validation rules,” while the preserved behavior includes “existing error types and return conventions remain unchanged.” Without such concrete constraints, a model may tidy up an interface while silently breaking existing callers.
For tasks that must be implemented in stages, write each step as “scope of change, acceptance action, pass criteria.” Stage boundaries should land on a verifiable state, rather than mechanically building after every file edit. If an interface change requires updating both the definition and its callers, group them into a single change unit and run targeted checks afterward. This keeps verification costs under control and prevents multiple unconfirmed changes from stacking up, which makes later errors hard to attribute.
2. When the Build Fails, Verify the Cause — Don’t Guess and Push Forward
A common mistake in multi-stage refactoring is when the model attributes a build failure to caching or environment issues, runs a cleanup, and then moves to the next stage without rebuilding. Cleanup only changes build conditions; it doesn’t prove the problem is gone. If the same error persists and subsequent changes introduce new diagnostics, a localized issue can escalate into a cross-module investigation.
A more reliable sequence:
- Record the failure evidence. Keep the build entry point, key diagnostics, and the corresponding change scope. If failures existed before the task began, record them first to avoid attributing pre-existing issues to your changes.
- Propose a verifiable explanation. For example, when a diagnostic points to a parameter type mismatch, compare the interface definition, the call site, and recent changes to confirm what each side expects. If you suspect a caching anomaly, rerun the same build step after cleanup and compare whether the diagnostic changes.
- Fix problems that can trigger cascading errors first. A single broken type definition can fail many call sites at once. Instead of patching each error flatly, identify the shared dependency and use a minimal change to validate your hypothesis.
- Rerun the failing items, then widen verification. After targeted checks pass, run regression cases for the affected modules or the whole project. If a missing environment prevents verification, explicitly mark it as “not verified” — writing the code is not the same as completing the task.
This workflow also constrains aimless trial and error. When a change doesn’t alter the expected diagnostic, revisit your assumption and, if necessary, revert the attempt rather than stacking more patches on top. What a reviewer really needs is an auditable evidence chain: which diagnostic supports which conclusion, which change verified that conclusion, and what remains unconfirmed.
3. Validate Visual Effects and Interaction Correctness with Different Criteria
A UI prototype can quickly show layout, lighting, and motion, but a screenshot cannot prove the program runs end to end. The visual layer answers “does it look right,” while the interaction layer answers “does the system reach the correct state after the user performs an action.” Check the two separately — never let one overall impression mask a defect in the other.
Take a sliding puzzle as an example: a tidy initial position only proves the layout works. Functional acceptance also requires checking whether tiles move according to the rules, whether out-of-bounds or overlapping moves are rejected, whether the win condition triggers correctly, and whether the board and move counter stay consistent after a reset. Similarly, if the design spec promises a particular material or lighting style, verify the actual rendered result instead of treating the written description as an implemented effect.
A 3D bowling demo requires checking pin placement, collision, and readability together. Pin spacing, collider sizes, and post-collision motion responses all affect the outcome of a shot — you cannot conclude a parameter is wrong just because one throw failed to knock down all pins. During testing, fix the initial pin placement and launch conditions, then test a head-on hit, an off-center hit, and a no-collision path separately. If the scene is too dark for users to see the ball, the lane, and the pins, the interaction fails even if the collision math is correct. For demos like this, basic visibility and a complete operational path should be validated before particle effects.
4. For Reinforcement Learning Demos, Separate Training, Execution, and Display Checks
A maze demo chains together environment state, action rules, the learning process, and rendering. A correctly displayed maze doesn’t mean the agent can act; stabilizing training metrics doesn’t mean playback will reach the goal. This is especially true when logical grid cells and display positions are misaligned: the internal state may have moved while the screen shows the agent hitting a wall or drifting off its cell. Relying on visual inspection alone makes it easy to misdiagnose a coordinate mapping bug as a training failure.
For debugging, split the system into three layers by dependency:
- Environment layer: Pick a small maze you can verify by hand, then step through legal moves, wall collisions, boundaries, goal states, and reset behavior. At this stage you can feed in action sequences directly without depending on training results.
- Policy layer: Save the trained policy in the same environment and evaluate playback separately. Record whether the goal is reached, the path length, and whether the step limit is exceeded. Exploration is allowed during training, but evaluation should explicitly state whether exploration is disabled, to avoid conflating the two run modes.
- Presentation layer: Ensure the terrain, agent, and numeric labels all use consistent grid indices, then check the coordinate origin, row/column orientation, and cell size. When reproducing a problem, inspect the logical position and the screen position side by side to determine whether the deviation occurs in state updates or in the rendering transform.
Displaying action values on the floor helps visualize how the policy evolves, but stable values are only a diagnostic clue, not standalone proof of success. If the maze has multiple start points or layouts, use corresponding evaluation samples; if it’s a fixed-level demo, report results for that level only — don’t generalize a single successful run into a conclusion about arbitrary environments.
5. Turn Trial Feedback into Reusable Delivery Records for the Team
Whether you’re experimenting individually or rolling out LLMs across a team, start by validating the collaboration workflow with representative tasks: a localized refactor of an existing codebase, an interactive prototype, and a demo involving state transitions. Before starting, pin down the initial code, verification entry points, and acceptance cases; afterward, record which checks actually passed, why manual intervention was needed, rework time, and unresolved issues. Asking for clarification is not a flaw in itself — what matters is whether the model keeps pushing forward when acceptance evidence is unavailable, or treats unconfirmed speculation as a root-cause conclusion.
Acceptance can be organized into three gates: it builds, it behaves correctly, and it can be reproduced reliably. The first gate rules out basic integration errors; the second validates business rules, exception paths, and key interactions; the third checks whether results depend on temporary environments, manual patches, or incidental state. A change that passes only the first gate can move into another round of debugging but should not be marked deliverable. For changes that will ultimately be merged, also review whether the change exceeds the task scope, whether test assertions were weakened without justification, and whether failure scenarios were bypassed instead of fixed.
LLMs can shorten the time needed to produce a first implementation draft or a working prototype, but what determines whether they can enter an engineering workflow is whether each change has inspectable boundaries and each claim of completion has reproducible evidence. Building verification into staged delivery makes problems easier to locate than a big-bang audit at the end — and makes it easier for a team to decide which work can be delegated to the model and which steps still require human review.
