The Real Capabilities and Limits of LLMs for Coding and Security Auditing
Benchmark scores alone cannot tell you whether a large language model is ready for a real development workflow. This article explains how to evaluate open-source LLMs more reliably: architecture trade-offs (MoE, RLHF, long context), engineering-level coding tasks such as multi-file refactoring, controlled Agent execution with sandboxing and rollback, and how LLM-based code auditing complements rule-based SAST tools. It also covers evaluation tables, failure modes, and the guardrails—testing, scanning, and human review—that must accompany any model output.
If you only look at leaderboard scores, it is hard to judge whether a large language model can actually fit into a development workflow. A more reliable approach is to observe its pass rate, failure modes, and controllability on fixed tasks. Current open-source LLMs already have practical value in code comprehension, multi-file refactoring, and security defect identification, but their outputs must be paired with testing, scanning, and human review, and they should only run inside sandboxes with permission constraints.
1. Architecture and Training: What Each Approach Solves
Mixture-of-Experts (MoE) models have a very large total parameter count, but only a subset of experts is activated for each token. A routing network decides which experts process the current input. The benefit is that the compute per inference pass is lower than that of a dense model with the same total parameters. The cost is equally clear: all expert parameters still need to fit into GPU memory or be sharded across multiple cards, so the deployment barrier does not disappear just because the activated parameter count is small. When selecting a model, compare total parameters, activated parameters, memory footprint, and throughput together.
Reinforcement learning in the post-training stage is used to adjust model behavior on specific tasks. RLHF is a category of training frameworks, and its policy optimization step is commonly implemented with algorithms such as PPO. For coding tasks, reward signals can come from verifiable outcomes—whether unit tests pass or whether the code compiles—which are more stable than human scoring. However, poorly designed rewards can teach the model to game the system, for example by deleting failing test cases. Evaluation should therefore check whether the model modified the tests themselves.
A very long context window lets you fit in more content, but that does not mean the model can use that content reliably. Models may be insensitive to information located in the middle of long inputs, and the longer the context, the higher the time to first token and the inference cost. When describing long-context capability, always note three things: the measured length, the task type, and whether retrieval or chunking strategies were used.
Evaluations should also record the model version, inference parameters (such as temperature and maximum output length), runtime environment, and dataset source. Results without this information cannot be reproduced or compared with other results.
2. Coding Ability: From Single-Line Completion to Multi-File Changes
The focus of engineering-level coding evaluation is system-level understanding, not single-line completion. Take a microservices migration as an example: a common task is to split the order module out of a monolithic application into an independent service.
Before starting, provide the following inputs:
- The existing directory structure and module dependency graph;
- Dependencies and version numbers, including the framework’s major version;
- Contract files for existing interfaces, such as OpenAPI documents;
- Database schemas and migration scripts;
- A rollback plan: keep a feature switch for the original module so traffic can be routed back to the monolith if problems occur.
The model’s migration plan must pass three checks: interface contracts remain compatible, all unit and integration tests pass, and the gateway routing configuration can complete one full call in the test environment.
The table below covers common coding tasks and can be used to compare different models or versions within a team.
| Task Type | Input | Pass Criteria | Common Failures | Manual Review Points |
|---|---|---|---|---|
| Single-file completion | Function signature and comments | Passes existing unit tests | Ignores edge cases | Exception handling paths |
| Multi-file refactoring | Module dependency graph and test suite | Tests pass and interfaces unchanged | Misses updating callers | Cross-module references |
| Legacy code migration | Old code and new framework docs | Feature parity with no new warnings | Uses deprecated APIs | Dependency versions |
| Bug fixing | Error logs and reproduction steps | Reproduction case turns green | Fixes symptoms, not the root cause | Scope of side effects |
3. Agent Tasks: Executable Workflows and Troubleshooting
In Agent mode, the model calls the terminal, reads and writes files, and runs tests. Take “add a JWT-based authentication module to the project and write unit tests” as an example. A typical workflow is: read the project structure, confirm existing dependencies, write the authentication middleware, modify the routing configuration, generate tests, and run them.
Before letting an Agent execute this kind of task, confirm the following conditions:
- Environment dependencies: the language version, package manager, and database are prepared inside the sandbox;
- Permission boundaries: writes are restricted to designated directories, and access to production secrets and external networks is forbidden;
- Sandbox isolation: run inside a container or virtual machine, not directly on the developer’s machine;
- Operation logs: record every command execution, file modification, and test result;
- Failure rollback: all changes are made on a separate branch or temporary workspace so they can be discarded entirely if things fail;
- Human confirmation: deleting files, changing dependency versions, and committing code must be approved by a person.
Common failures and troubleshooting steps are listed below:
| Symptom | Possible Cause | Troubleshooting Steps |
|---|---|---|
| Tests keep failing | Dependency version mismatch | Check the lockfile, pin versions, and rerun |
| Authentication logic bypassed | Middleware not mounted on the route | Check route registration order and the middleware list |
| Test cases modified | Model altered tests to make them pass | Diff the test files and restore the originals |
| Command hangs for a long time | Waiting for interactive input | Add non-interactive flags and set timeouts |
| Secrets hard-coded | Secret management requirements not followed | Read from environment variables and add scanning rules |
4. Code Security Auditing: Capabilities, Methods, and Boundaries
Traditional static application security testing (SAST) tools rely on rule matching. Their results are stable and explainable, but they produce many false positives and struggle to understand business semantics. LLMs can use context to judge whether a piece of code is actually exploitable, making them well suited for triaging SAST alerts or finding logic issues that rules do not cover. The comparison is as follows:
| Dimension | Rule-based SAST | LLM-based Auditing |
|---|---|---|
| Reproducibility | Same input, same result | Affected by model version, parameters, and prompts |
| Source of false positives | Overly broad rules | Incorrect inference about context |
| Business logic flaws | Weak coverage | Some capability; conclusions need human verification |
| Result explanation | Usually a rule ID | Can give natural-language explanations, but they may be inaccurate |
| Suitable usage | Baseline scanning, merge gates | Alert triage, supplementing manual audits |
Take SQ
