Intermediate Representation Pipeline for Accurate LLM Code Generation

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Large language models (LLMs) face limitations in generating correct and syntactically formatted compilable computer code, especially for proprietary or complex types, and scaling issues arise due to token limits and increased processing time.

Innovation Solution

Generate an intermediate representation using an LLM and a separate programmatic component to compile it into compilable code, utilizing a feature tree to break requests into smaller parts and preserve dependency relationships, and employ cloud computing for scalable processing.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If LLM directly generates compilable computer code, then generation speed is fast, but code accuracy and syntax correctness deteriorate

Engineering Contradiction:
Improvegeneration speedVSAvoidcode accuracy
Core Design Contradiction:
ProductivityVSManufacturing precision

Solution Approach 1:

The patent introduces an intermediate representation as a mediator between the LLM and the final compilable code. The LLM generates the intermediate representation which is then processed by a programmatic component to produce the final code. This intermediary layer allows the LLM to focus on high-level logic while the programmatic component ensures syntax correctness and compilation readiness, thereby resolving the contradiction between generation speed and code accuracy.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Adaptability or versatility

If LLM processes complex proprietary code types, then code generation capability is improved, but reliability deteriorates due to training data limitations

Engineering Contradiction:
Improvecode generation capabilityVSAvoidoutput correctness
Core Design Contradiction:
Adaptability or versatilityVSReliability

Solution Approach 1:

The patent segments the code generation process into two distinct stages: (1) the LLM generates an intermediate representation focusing on high-level logic and semantics, and (2) a programmatic component translates this into syntactically correct compilable code. This segmentation allows the system to handle complex proprietary code types reliably by separating the creative generation aspect (handled by LLM) from the syntax validation and translation aspect (handled by programmatic components with explicit rules for proprietary formats).

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The intermediate representation serves as a mediator that translates between natural language requests and proprietary code formats. It captures the semantic intent from the LLM's generation and provides a structured intermediate form that the programmatic component can reliably transform into correct compilable code, thereby improving reliability for proprietary code types without sacrificing adaptability.

Inventive Principle:
Principle #24Intermediary (Mediator)

3Adaptability or versatility

If LLM handles large number of features and complex requests, then functionality is improved, but processing time and token usage increase

Engineering Contradiction:
Improverequest handling capabilityVSAvoidprocessing time
Core Design Contradiction:
Adaptability or versatilityVSLoss of time

Solution Approach 1:

The patent segments complex requests into multiple smaller sub-requests based on a feature tree structure. Each feature or group of related features is processed separately through individual LLM calls, generating intermediate representations that are then merged. This segmentation reduces the token count and processing time for each individual LLM call while maintaining the ability to handle complex requests with multiple features, thereby resolving the contradiction between functionality and processing time.

Inventive Principle:
Principle #1Segmentation

4Productivity

If LLM generates intermediate representation for each feature separately, then processing efficiency is improved, but system complexity increases

Engineering Contradiction:
Improveprocessing efficiencyVSAvoidsystem architecture complexity
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The patent performs preliminary action by first constructing a feature tree that organizes all features and their dependency relationships before processing. This tree structure is built once and then used to systematically generate prompts for each feature in the correct order. The preliminary organization into a feature tree simplifies the overall system architecture by providing a clear processing roadmap, reducing the complexity of managing multiple feature requests and their interdependencies during execution.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentEP4708119A1Modular subsequent generations of dedicated intermediate representations
Publication Date: 2026.03.11 SAP SE
  • EP4708119A1 patent drawingFigure 1
  • EP4708119A1 patent drawingFigure 2
  • EP4708119A1 patent drawingFigure 3

AI summary

In an example embodiment, a feature tree of all features in a request is generated. This feature tree describes interrelations between features that are dependent upon one another. The request is then broken into multiple, smaller requests. More particularly, each feature is included in its own dedicated request. Based on the dependencies, the smaller requests are then sent to the LLM in an order that preserve the dependency relationships. Intermediate results generated by the LLM in response to the multiple smaller request are then merged into a single intermediate result that can then be passed to the programmatic component for compiling.