Engineering LLM Systems: Coding, Vision, and Safety Evaluation
This article explains why stronger model capabilities are not enough for production use. It covers how to evaluate coding agents with executable evidence, manage long-running tasks to limit goal drift, treat visual understanding as a verify-then-act loop, separate model refusals from system controls, and measure cost per accepted result before rollout.
From capability updates to engineering problems
Large language models are improving along several axes: harder programming work, more consistent goals over long executions, finer-grained image understanding, and better recognition and restriction of high-risk requests.
For developers and enterprises, “a stronger model” is not an acceptance criterion. The questions that matter are whether the system can make correct changes in a real codebase, whether it stays aligned with the user’s goal after many steps, whether it can justify judgments on complex UIs and charts, and how it prevents unauthorized actions and sensitive-data leaks after it is connected to internal systems.
Technical evaluation should therefore move from the quality of a single reply to success rate across the full task chain. A plausible answer may fail tests; a successful tool call may still cause the wrong business side effect. Engineering work means putting generation inside verifiable processes, not treating model output as the final result.
Intelligent coding: measure quality with executable evidence
Coding ability is not the same as code generation
Real software work includes understanding requirements, analyzing dependencies, preserving API compatibility, handling errors, and regression testing. Syntactically valid code can still misread business constraints, miss edge cases, or change the wrong modules.
Evaluation should at least cover:
- Local edits: fix a well-specified defect and check that the change is accurate and restrained.
- Cross-module work: update several components and verify that interfaces and data flow stay consistent.
- Test completion: add tests that actually cover existing logic, not only the happy path.
- Unfamiliar code: locate issues with incomplete information and state the evidence for the diagnosis.
Change restraint deserves its own metric. Rewriting large regions just to pass current tests can raise maintenance cost and break untested behavior. A good outcome should satisfy the requirement, quality bar, and change-scope constraints together.
A layered verification workflow
Organize coding tasks as understand, plan, modify, verify, and deliver.
Understanding should lock expected behavior, forbidden change areas, and acceptance criteria. Planning should list modules, risks, and tests. Modification should produce reviewable diffs. Verification should run static checks, unit tests, and needed integration tests. Delivery should summarize the change, evidence, and remaining risk.
A typical flow:
Receive the request→ Confirm constraints and acceptance criteria→ Form a modification plan→ Apply changes in an isolated environment→ Run checks and tests→ Correct from failure evidence→ Produce a delivery note
Model self-review can catch some issues but cannot replace external verification. The explanation and the code may share the same wrong assumption, so “self-check passed” can still mean incorrect behavior. Test results, runtime logs, and human review should be independent evidence.
Interpreting benchmark scores
Pass rates on single benchmarks are useful references, not a direct estimate of internal task success. Task mix, codebase size, context supplied, tool permissions, and retry policy all change outcomes.
Enterprises should maintain their own task sets for common needs and high-loss cases, with a unified execution environment and resource budget. Besides pass rate, track average attempts, human rework, unnecessary-change rate, and regression defects, so capability gains can be judged as real development efficiency.
Long-running tasks: reduce goal drift with explicit state
Long tasks are not only about more input tokens. They require continuously maintaining goals, constraints, evidence, and execution state. As steps grow, models may forget early requirements, repeat finished work, or treat unconfirmed guesses as facts.
Separate state from the chat log
Do not rely only on a growing conversation. Keep explicit state: goal, constraints, current step, confirmed facts, open issues, and artifact locations.
Example:
Goal: fix exception handling in a specified business flowConstraint: do not change existing external APIsDone: localization, reproduction testsCurrent step: implement a minimal fixTo verify: bad inputs, concurrent execution, historical regressionStop: acceptance passed, or execution budget reached
State summaries should cite tool results and real artifacts, not only the model’s own conclusions. Enforce critical constraints with programmatic checks or permissions rather than leaving them to model memory.
Checkpoints and stop conditions
Save checkpoints by stage. Confirm the previous stage before advancing. On failure, restore the last valid state to limit repeated work and error accumulation.
Cap runtime, call count, cost, and consecutive failures. When a threshold is hit, stop automation and hand off to a human instead of retrying indefinitely.
Operations with external side effects need extra care. Payments, notifications, and resource deletion must not fire again because a task was resumed. Use idempotency, explicit operation logs, and human approval where needed.
Visual understanding: resolution is only one input condition
Higher-resolution images help preserve small text, UI details, and dense charts, but a larger image does not automatically mean more accurate understanding.
Clarity, compression, text density, layout, and how the model processes the image all matter. Systems may scale or tile inputs, so pixel count does not map to a fixed inference cost or accuracy.
Global locate, then local analyze
For complex screenshots or documents, identify overall layout first, then analyze important regions in detail. That keeps global relationships without flooding the model with irrelevant pixels.
Extracting a value from a chart should start with chart type, axes, units, and legend, then locate the data point. Correct OCR of a number is still a business error if units, time range, or series names are ignored.
Structured extraction should include field values, source regions, and validation status. Uncertain content should be marked missing or pending review, not filled with a plausible guess.
Verify after UI actions
Visual agents typically loop through observe, decide, act, and confirm. Finding a button does not mean the click completed the intended operation.
UIs have load delay, overlays, dialogs, and layout shifts. After each critical action, recapture state and check that the expected page, message, or data appeared. High-risk actions such as submitting orders, granting access, or deleting data should also require human confirmation.
Safety governance: model defenses are not system controls
Model refusal of high-risk requests is an important layer, but it cannot carry all security responsibility. Business systems still need least privilege, authentication, isolation, audit logs, and anomaly alerts.
Untrusted content must not become instructions
Prompt injection can arrive through documents, web pages, comments, logs, or text in images. Attackers try to make the model treat that content as new operational commands, then leak data or act beyond authorization.
The key is to separate data being processed from instructions that may control the task. External content is analysis material only; it must not change system rules, authorization, or objectives.
Before tool calls, independent logic should check target resources, parameter ranges, access rights, and action risk. A model proposing an action is not the same as that action being authorized.
High-risk capabilities need auditable bounds
For sensitive work such as security analysis, confirm user identity, asset ownership, and authorization, and limit intensity, environment, and who can see results.
Defensive tasks need bounds too. Asset checks stay inside authorized scope, tests should not hit production services, and sensitive results should be stored and viewed by permission. Phrases such as “research” or “testing” in a request do not by themselves make the work legitimate.
Evaluate safety by risk class. Better blocking of one attack type does not mean all risks fell together. After a model upgrade, run security regression with attention to unauthorized execution, data leakage, dangerous advice, and false refusals.
Cost and launch: price each accepted result
Model call price is only part of total cost. Context, output length, vision processing, tools, retries, and human review all add up.
A more useful metric:
Cost per accepted task= total spend to complete work ÷ number of tasks that pass acceptance
Total spend includes compute plus reasonably allocated engineering and human handling. Cheap calls with heavy rework may not be cheaper; high-capability setups on trivial tasks can waste budget.
Allocate by complexity: deterministic work such as format conversion can use rules; routine analysis can use a lower budget; complex reasoning and critical decisions get more verification. Filter context by relevance instead of repeatedly sending unrelated material.
Roll out in stages:
- Offline evaluation on representative tasks for quality, risk, and cost.
- Shadow mode: generate suggestions without executing side-effecting actions.
- Limited pilots with constrained users, scenarios, and permissions to observe real failures.
- Gradual expansion with monitoring and a rollback path.
Monitor success rate, latency, cost, retries, permission denials, human takeovers, and rollbacks. After model, prompt, or tool-config changes, revalidate critical tasks; do not swap production paths on version notes alone.
Conclusion: turn capability gains into acceptably measured system value
Progress in coding, long-horizon execution, and vision enables more automation, but reliability still depends on system design.
Prioritize four foundations: evaluation sets centered on real tasks, verification independent of model explanations, recoverable task state, and permission boundaries the model cannot bypass. When results have evidence, processes are traceable, failures can stop, and actions can roll back, capability improvements can become efficiency and quality gains that an enterprise can actually accept.
