LLM-Assisted Engineering Development: A Disciplined Workflow for Complex Tasks
This article describes a disciplined workflow for using large language models in complex engineering tasks such as firmware porting. It covers a five-stage process that forces alignment before implementation, rigid validation mechanisms that define objective evidence of completion, sub-agent scheduling for context isolation, and document preprocessing to improve the model’s understanding of technical specifications. The article also summarizes reusable practices for porting, refactoring, and batch modification projects.
1. Background: From Conversational Completion to Engineered Collaboration
Over the past two years, the capability boundary of large-model-assisted programming has continued to expand. Early usage was mostly question-and-answer style: a developer describes a piece of logic, the model generates code, and correctness depends entirely on manual review. This approach works for small-scale scenarios. Once task scale rises to cross-file refactoring, module porting, or batch modification, problems become exposed: the model tends to modify code directly without aligning on requirements, deviates from the direction halfway through, or claims by “impression” that a task is complete when the code has not even compiled.
What truly enables large models to deliver stable value in complex engineering tasks is not stronger conversational ability in the model itself, but a set of disciplined workflow constraints. This article uses a typical firmware porting project as background, involving dozens of files and hundreds of changes, and summarizes the methodology and engineering practices involved. The ideas can be implemented with general large-model services and intelligent programming tools. For example, a combination of model services provided by Baidu AI Cloud and common command-line coding agent tools belongs to mature general solutions in the industry. This article does not evaluate or focus on any specific product.
2. Staged Workflow: Force AI to Align Before Acting
The primary cause of failure in complex engineering tasks is that requirements and implementation paths are not aligned. Therefore, one of the most valuable practices is to divide “doing one thing” into five mandatory stages:
- Brainstorming: Ask the model to first list its understanding of the requirements, possible implementation paths, and potential risk points, and output text rather than code.
- Spec: Solidify the requirements into an explicit specification document, including input/output conventions, constraints, and acceptance criteria.
- Plan: Break the specification into a task list that can be executed and verified independently, clarifying the files and change scope involved in each task.
- Execute: Implement item by item according to the plan, and prohibit modifications to files outside the planned scope.
- Review: Conduct an overall review of the changes and confirm consistency with the specification.
The essence of this process is to compress the model’s “free-play space” into each stage. At the end of each stage, the model must produce checkable intermediate artifacts, such as an understanding statement, a specification document, and a task list. Developers only need to review these lightweight artifacts to intercept directional errors early. Experience shows that if a directional error is discovered only during the execution stage, the repair cost is often more than ten times that of the alignment stage.
3. Rigid Validation: Objective Standards for “Done”
The staged workflow solves “what to do.” The next question is “how to determine that it is done.” In practice, several types of rigid validation skills need to be built in:
- Test-driven development (TDD): Require test cases to be written before implementation. For porting tasks, test cases can be migrated from existing tests on the original platform and naturally form an acceptance baseline.
- Systematic debugging: When failures occur, “guess-based fixes” are not allowed. The model must first reproduce the issue, locate the root cause, propose a hypothesis, verify the hypothesis, and then modify the code. This constraint is especially effective in preventing the model from falling into a loop of “fix A and B breaks, fix B and C breaks.”
- Pre-completion verification: This is the most easily overlooked but highest-return constraint. Force the model to actually execute a build command before claiming that “compilation passes,” and use the actual output as evidence. Without this constraint, the model often gives optimistic conclusions based on context inference.
A simple implementation approach is to register validation hooks in the tool configuration. Any reply containing a “complete” or “pass” conclusion must include the most recent build or test command and exit code. An example is shown below:
{"hooks": {"before_completion_claim": "run_build_and_test","evidence_required": ["exit_code", "last_output_lines"]}}
4. Sub-Agent Scheduling: Combat Task Growth with Context Isolation
For porting projects involving dozens of files and hundreds of changes, a single conversation context is quickly flooded with implementation details, causing the model in the main conversation to “lose memory” or be disturbed by noise. A common industry solution is sub-agent scheduling:
- The main conversation maintains only the plan and status, without carrying the specific implementation process.
- Each task in the plan is dispatched to a sub-agent with an independent context for execution.
- After completion, the sub-agent returns only structured results: which files were changed, validation conclusions, and remaining issues.
This approach provides two benefits. First, the context of the main conversation remains clean, and the model’s planning ability is not diluted. Second, tasks are naturally isolated from one another, and the failure of one sub-agent does not pollute the state of other tasks. It can be argued that context management capability is the decisive factor in whether complex tasks can be completed, and its importance is no less than the model’s own reasoning ability.
5. Document Preprocessing: A Key Step Before Feeding Specifications to the Model
Another widely validated practice is document format preprocessing. Large models generally have low retrieval accuracy on PDFs, especially for tables, register bit-field diagrams, watermarks, and scanned images commonly found in chip specifications, which are often parsed into fragmented content. When the same content is converted to Markdown, retrieval and understanding accuracy improve by an order of magnitude.
In practice, a three-step pipeline can be built:
- Parsing and denoising: Strip watermarks, headers, and footers, and identify the body structure.
- Table and image structuring: Convert tables into Markdown tables or HTML tables, and convert bit-field diagrams into textual descriptions.
- Chunking and indexing: Split by chapter and retain the heading hierarchy as retrieval anchors.
After processing, place the content in the project’s reference documentation directory, such as refer/docs/, so the model can truly “read” it rather than guess from a PDF. For platform documents that often run to hundreds of pages, such as EDS, BIOS specifications, and display configurations, the upfront investment in this step will continue to pay off throughout the engineering cycle. Document intelligent parsing services from various cloud vendors can handle this kind of general processing, without relying on a specific tool.
6. Conclusion
The upper limit of the value of large-model-assisted development depends on the completeness of engineering constraints. Three reusable core lessons are: use a staged workflow to force alignment before action; use rigid validation to give “done” objective evidence; and use sub-agent scheduling and document preprocessing to manage context quality. This methodology does not depend on any specific product. It can be implemented with general large-model services, such as model capabilities on Baidu AI Cloud, and common coding agent tools, and is suitable for high-complexity engineering scenarios such as porting, refactoring, and batch modification.
