Program Synthesis With Unit-Test Feedback for Functional Correctness

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing program synthesis models have limited performance due to neglecting important signals from unit tests and accumulating errors during generation, leading to poor performance in complex coding tasks.

Innovation Solution

A reinforcement learning-based framework that finetunes pretrained language models using an actor-critic approach, incorporating unit tests to evaluate and refine generated code, and employs a program refining and repairing procedure to enhance accuracy.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If standard supervised fine-tuning procedure is used to train program synthesis model from natural language problem descriptions and ground-truth programs, then the model can be trained with available data, but the code generation performance is limited due to ignoring important signals from unit tests

Engineering Contradiction:
Improvecode generation performanceVSAvoidunit test signals
Core Design Contradiction:
ReliabilityVSLoss of information

Solution Approach 1:

The patent implements a reinforcement learning framework where unit tests provide feedback signals to guide program synthesis. The critic network evaluates generated programs using unit tests and provides reward signals to the actor network, enabling the model to learn from test outcomes and improve code generation performance while utilizing unit test information effectively

Inventive Principle:
Principle #23Feedback

Solution Approach 2:

The patent introduces a critic network as an intermediary between the actor network and unit tests. The critic network processes unit test results and translates them into meaningful reward signals, serving as a mediator that bridges the gap between program generation and test evaluation while preserving important unit test signals

Inventive Principle:
Principle #24Intermediary (Mediator)

2Ease of operation

If pretrained language models are adapted for sequence-to-sequence code generation, then the models can generate programs from natural language input, but error accumulation during generation leads to poor performance on complex coding tasks

Engineering Contradiction:
Improvenatural language to code generationVSAvoidfunctional correctness
Core Design Contradiction:
Ease of operationVSReliability

Solution Approach 1:

The reinforcement learning framework provides continuous feedback during program generation through the critic network. Unit test results are evaluated at intermediate steps and provide corrective feedback to the actor network, preventing error accumulation and improving functional correctness of generated programs on complex coding tasks

Inventive Principle:
Principle #23Feedback

Solution Approach 2:

The patent employs dynamic program refinement where the generation process can be adjusted and refined based on intermediate evaluation results. The system can regenerate or modify program segments that fail unit tests, making the generation process adaptive and dynamic rather than static and error-prone

Inventive Principle:
Principle #15Dynamics

Data Source

PatentUS12430585B2Systems and methods for program synthesis
Publication Date: 2025.09.30 SALESFORCE INC
  • US12430585B2 patent drawing
  • US12430585B2 patent drawing
  • US12430585B2 patent drawing

AI summary

Embodiments described herein provide a reinforcement learning based framework engaging pretrained language models (LMs) for program synthesis tasks. Specifically, the framework adopts a training strategy that optimizes pretrained LMs for program synthesis tasks in an actor-critic approach.