Large vs. Small LLMs in Engineering: Lessons from a Lock Design Failure

    This article examines how model scale affects intent understanding in enterprise software engineering, using a lock-design failure as a case study. It explains why benchmark scores are insufficient for model selection, how small-parameter models may default to plausible but architecturally wrong implementations under ambiguous prompts, and recommends a layered strategy: large models for architecture and complex business logic, small models for well-defined mechanical tasks, and prompt checklists or context injection to align intent. It also highlights that passing functional tests does not guarantee design correctness.

    1. Starting Point: Model Selection Is About Scenarios, Not Leaderboards

    In everyday developer discussions, large-model evaluation often revolves around benchmark leaderboards. Models with similar scores may seem interchangeable. But when you are responsible for an enterprise-level project and are building a business system from scratch, you quickly discover that benchmark scores are only a reference. The real dividing line is a model’s ability to understand intent, not merely its ability to execute instructions.

    This is especially true in public-sector and state-owned enterprise projects with strict data-security requirements. For compliance reasons, such projects often explicitly prohibit foreign LLMs and their associated coding toolchains in core workflows. As a result, model selection may be limited to a pool of domestically approved models. The selection space is narrower, but the business requirement for “understanding” does not decrease. This is the practical context that brings the topic of parameter scale back to the table.

    2. A Real Case: One Missing Sentence Put the Lock in the Wrong Place

    Recently I was developing an internal enterprise system involving dual management of data and archives. The relationship is: archives depend on data records for their existence, and any archive operation is essentially a derivative operation on a data record.

    For operational safety, this type of scenario requires an exclusive lock to prevent data inconsistency caused by concurrent operations. I described the requirement in the prompt, but I omitted one key detail: “lock the primary key id of the data record.” As a result, the small-parameter model made a default decision on its own: it locked the id of the folder containing the archive.

    On reflection, that approach is not completely unusable:

    • It does provide some degree of mutual exclusion and can pass functional tests;
    • From superficial behavior, the system “looks safe.”

    But it deviated from my design intent. My original idea was to place an exclusive lock directly on the data primary key id, so that archive operations would naturally be excluded. This would:

    1. Greatly simplify code and lock-management logic—only one lock would cover the entire data path;
    2. Fundamentally avoid a race-condition risk: while a background job is changing data, another user deletes the entire record, leaving the background operation dangling, causing transaction failure or even dirty data.

    The difference between these two lock strategies cannot be caught by tests—it is a question of architectural correctness, and it can only be judged by understanding the full business picture. This is exactly where small-parameter models fall short.

    3. Why Model Scale Affects “Understanding”

    A common misunderstanding needs to be clarified: small-parameter models do not “fail to understand” requirements. Rather, they have extremely low tolerance for ambiguity. This shows up in specific ways:

    • Prompts must be extremely detailed. Boundary conditions, exception branches, and default behavior must all be written clearly, with no ambiguity. If one sentence is missing, the model will fill in a default implementation based on the most common pattern.
    • They lack proactive contextual reasoning. Small models tend to treat instructions as isolated tasks and do not actively combine them with the project’s overall context to infer “what you are really trying to solve.”

    The advantage of large-parameter models lies precisely here: they have stronger context-window utilization and richer internal representations. They can combine previous conversation, code style, and architectural conventions to infer the real purpose behind an instruction. Even if the instruction is slightly ambiguous, they can produce a result highly consistent with the design intent.

    This is also why two models with similar benchmark scores can feel completely different in practice. Scores measure task completion; experience depends on intent alignment. Of course, there is no free lunch. Large-parameter models usually mean higher inference cost and longer response latency, which must be considered during model selection.

    4. Practical Division of Labor in Engineering

    Based on the above analysis, I recommend a “layered usage” strategy in real projects rather than simply “choosing one large model and using it for everything”:

    1. Architecture design, complex business logic, and cross-module refactoring: use large-parameter models

    These tasks share a common feature: requirement descriptions are naturally ambiguous and require the model to infer intent from context. The lock-design problem in the case above belongs to this category. A large model can understand that “why to lock” matters more than “where to lock.”

    2. Clearly defined mechanical tasks: use small-parameter models

    Examples include generating unit tests according to established specifications, formatting conversion, batch renaming, and adding comments. These tasks have clear instruction boundaries, and small models execute them quickly and at low cost.

    3. Use prompt engineering to bridge the capability gap

    If cost constraints require the use of small models, prompt templates can enforce the completion of missing information. For concurrency scenarios, for example, constraints can be固化 into a checklist:

    1. [Concurrency Safety Checklist]
    2. - Lock granularity object: <{data primary key id | archive id | other}> (must be explicitly specified)
    3. - Lock type: <{exclusive lock | shared lock}>
    4. - Lock lifecycle: <{within transaction | within request}>
    5. - Mutual exclusion requirement between delete operations and in-flight transactions: <description>

    This essentially transfers the cost of “model inference” to “human specification.” It is feasible, but maintenance costs are not low, and omissions can easily occur, as in this case.

    5. A Deeper Issue That Is Easy to Overlook: Passing Tests Does Not Mean Correct Design

    The most alarming aspect of the case is this: the wrong locking strategy can pass all functional tests. Tests verify “explicitly defined behavior,” while architectural defects often hide in “undefined boundaries.” The lessons are:

    • For AI-generated code, review should focus not only on functional correctness but also on consistency with design intent;
    • For code involving concurrency, transactions, and data consistency, it is advisable to ask the model in the prompt to first output “my understanding and solution assumptions,” confirm them manually, and then generate the implementation—moving intent alignment before coding;
    • At the team level, domain constraint documents should be accumulated, such as lock strategy and transaction boundary specifications, and injected as context regardless of which model is used.

    6. Conclusion

    The essence of model selection is finding a balance between “intent-understanding capability” and “cost efficiency.” Small-parameter models are suitable for task execution with clear boundaries, while large-parameter models are suitable for complex design that requires contextual reasoning. They are not substitutes but a division of labor. When your requirement description contains business intent that cannot be fully made explicit—like the implicit design of “locking the data primary key” in this case—the understanding gap caused by parameter scale becomes the key variable determining delivery quality. Leaderboards can be a reference, but the real basis for selection is always your own project’s complexity structure and compliance constraints.