Architecture as Capability Equalizer for Coding Agents
Organizations: Siemens Digital Industries Software Princeton, NJ, USA
Abstract
LLM-based coding agents generate complete software systems from high-level descriptions, yet little is known about how the format of architecture specifications affects the quality of generated code or whether this effect depends on model capability. We present a controlled experiment comparing five informationally equivalent specification formats (informal prose, Mermaid diagrams with constraints and ADRs, OpenAPI, C4/Structurizr DSL, and TypeScript interface contracts with ArchUnit-style rules) across six models from three vendor families (Anthropic Claude, OpenAI GPT, Google Gemini). Across 90 multi-turn agent trials, specification format shows a strong format x model interaction. On the strongest models (Sonnet 4.6, GPT-5), format barely matters (quality spread 0.17-0.92). On weaker models, format produces spreads of 0.83-2.42 points, with code-proximate formats (OpenAPI, TypeScript contracts) recovering most of the capability gap. Mid-tier models can consume more tokens than frontier models for worse output when they enter compilation debugging loops that stronger models avoid. Self-validation rates collapse from 100% (Sonnet) to 0% (Gemini Flash) across the capability spectrum. TypeScript contracts triple API route coverage for the weakest model (33% to 100%). Structured architecture specifications serve as a capability equalizer, with value inversely proportional to model strength and the largest returns for cost-optimized deployments.
Figures & tables
| Format | Specification Excerpt |
|---|---|
| Prose | Services should not call each other directly. Instead, we use a simple in-memory Event Bus — a publish/subscribe system. When something notable happens, the originating service publishes an event to the Event Bus. Other services that care about those events subscribe to them and react accordingly. |
| Mermaid + Constr. | graph TD TaskSvc –¿—publish— EventBus[ Event Bus ] CommentSvc –¿—publish— EventBus EventBus –¿—subscribe— NotifSvc UserSvc — UserStore[( User Store )] % Constraint 1: Services MUST NOT import or call % other services directly. |
| OpenAPI 3.0 | paths : /tasks/{id}/assign : put : summary : Assign task to user requestBody : schema : properties : assigneeId : { type : string } responses : ’200’ : { $ref : Task } |
| C4 / Structurizr | workspace { model { taskService = container ”Task Service” { taskStore = component ”Task Store” ”Map¡string,Task¿” taskOps = component ”Task Operations” } taskService -¿ eventBus ”Publishes task.assigned” commentService -¿ eventBus ”Publishes comment.added” eventBus -¿ notificationService ”Delivers events to” } } |
| TS Contracts | interface ITaskService { create(input: CreateTaskInput ): Task ; assign(taskId: string , assigneeId: string ): Task ; changeStatus(taskId: string , newStatus: TaskStatus ): Task ; } RULE 1 : NO_CROSS_SERVICE_IMPORTS Files matching ”services/-service.ts” MUST NOT import from other ”services/-service.ts” |
| Judge Scores | Resource Consumption | Constr. | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Condition | Trial | Arch | Comp | Qual | Constr | Overall | Tokens (K) | Turns | LoC | Errors | Violations |
| Prose | T1 | 8 | 9 | 9 | 8 | 8.50 | 367 | 23 | 1,823 | 2 | 0 |
| T2 | 8 | 9 | 9 | 8 | 8.50 | 602 | 28 | 1,810 | 3 | 0 | |
| T3 | 7 | 9 | 9 | 8 | 8.25 | 332 | 24 | 1,424 | 2 | 0 | |
| Mermaid + Constr. + ADRs | T1 | 9 | 10 | 9 | 10 | 9.50 | 1,735 | 42 | 1,576 | 4 | 1 |
| T2 | 8 | 9 | 9 | 9 | 8.75 | 412 | 24 | 1,332 | 2 | 0 |
| Metric | Prose | Mermaid + Constr. | OpenAPI | C4 | TS Contracts |
| Judge Scores (1–10 scale, higher is better) | |||||
| Architectural Adherence | |||||
| Completeness | |||||
| Code Quality | |||||
| Constraint Compliance | |||||
| Overall |
| Judge Scores | Resources | Constr. | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Condition | Trial | Arch | Comp | Qual | Constr | Overall | Tok. (K) | Turns | LoC | Viol. |
| Prose | T1 | 4 | 6 | 7 | 4 | 5.25 | 558 | 30 | 1,319 | 7 |
| T2 | 5 | 6 | 6 | 4 | 5.25 | 506 | 26 | 1,334 | 1 | |
| T3 | 6 | 7 | 7 | 5 | 6.25 | 867 | 38 | 1,350 | 2 | |
| Mermaid + Constr. + ADRs | T1 | 5 | 7 | 7 | 4 | 5.75 | 535 | 29 | 1,618 | 2 |
| T2 | 8 | 7 | 8 | 9 | 8.00 | 573 | 30 | 1,398 | 0 |
| Anthropic | OpenAI | |||||
|---|---|---|---|---|---|---|
| Format | Sonnet 4.6 | Haiku 4.5 | GPT-5 | GPT-5-mini | Gem. Pro | Gem. Flash |
| Prose | ||||||
| Mermaid + Constr. | ||||||
| OpenAPI | ||||||
| C4 / Structurizr | ||||||
| TS Contracts |
| Model | TSC | TSC Pass | Demo Run | Demo |
|---|---|---|---|---|
| Attempts | Rate | Rate | Fail | |
| Sonnet 4.6 | 5.1 | 53% | 100% | 0.4 |
| Haiku 4.5 | 8.6 | 61% | 80% | 0.5 |
| GPT-5 | 4.1 | 13% | 53% | 0.7 |
| GPT-5-mini | 4.7 | 17% | 40% | 0.3 |
| Gemini 2.5 Pro | 3.7 | 22% | 20% | 0.3 |
| Format | Sonnet | Haiku | GPT-mini | Gem. Fl. |
|---|---|---|---|---|
| Prose | 15% | 20% | 11% | 33% |
| Mermaid+Constr. | 36% | 9% | 17% | 20% |
| OpenAPI | 15% | 10% | 8% | 13% |
| C4 | 28% | 16% | — | 23% |
| TS Contracts | 23% | 17% | — | — |
| Anthropic | OpenAI | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Sonnet | Haiku | GPT-5 | GPT-mini | Gem. Pro | Gem. Flash | |||||||
| Format | Route | Compl | Route | Compl | Route | Compl | Route | Compl | Route | Compl | Route | Compl |
| Prose | 100 | 100 | 100 | 88 | 100 | 100 | 85 | 97 | 100 | 93 | 33 | 71 |
| Mermaid+C. | 100 | 97 | 100 | 93 | 100 | 100 | 100 | 98 | 100 | 95 | 33 | 73 |
| OpenAPI | 100 | 100 | 100 | 97 | 100 | 100 | 100 | 100 | 100 | 100 | 33 | 72 |
| C4 | 100 | 97 | 100 | 97 | 100 | 100 | 100 | 98 | 67 | 85 | 67 | 85 |
| Model | Tokens (K) | Overall | Score/100K |
|---|---|---|---|
| Sonnet 4.6 | 640 | 8.42 | 1.32 |
| GPT-5 | 248 | 7.08 | 2.85 |
| Gemini Pro | 329 | 6.07 | 1.85 |
| Haiku 4.5 | 735 | 6.50 | 0.88 |
| GPT-5-mini | 225 | 6.72 | 2.99 |
| Gemini Flash | 223 | 6.35 | 2.85 |
| Metric | No Arch | Prose | |
| Judge Scores (1–10) | |||
| Arch. Adherence | |||
| Completeness | |||
| Code Quality | |||
| Constraint Compliance | |||
| Overall |
| Dimension | Auto Metric | Sonnet ( =90) | GPT-5 ( =28) |
|---|---|---|---|
| Completeness | Route coverage | ||
| Constraint Compl. | Violations | ||
| Constraint Compl. | Compliance % | ||
| Arch. Adherence | Compliance % |
| Dimension | Sonnet mean | GPT-5 mean | Bias | |
|---|---|---|---|---|
| Arch. Adherence | ||||
| Completeness | ||||
| Code Quality | ||||
| Constraint Compl. | ||||
| Overall |
| Generator Family | Sonnet judge | GPT-5 judge | Bias |
|---|---|---|---|
| Anthropic ( =10) | |||
| OpenAI ( =8) | |||
| Google ( =10) |