Dynamic Programming Language Model (DPLM)
- Dynamic Programming Language Model (DPLM) is a 7B-parameter open-source LLM designed to auto-formulate dynamic programming problems by transforming natural language into reasoning traces, models, and executable code.
- It leverages a two-stage training process with supervised fine-tuning and reinforcement learning alignment, utilizing the DualReflect framework to generate diverse and accurate DP problem trajectories.
- Empirical results on DP-Bench show that DPLM outperforms larger and general-purpose models on hard stochastic DP problems, highlighting its specialized efficacy in DP auto-formulation.
Searching arXiv for the Dynamic Programming LLM paper and related dynamic-programming background. arXiv search query: "Dynamic Programming LLM" Dynamic Programming LLM (DPLM) is a specialized 7B-parameter open-source LLM for auto-formulating dynamic programming (DP) problems from natural-language descriptions (Zhou et al., 15 Jul 2025). In the formulation reported for DPLM, a problem statement is transformed into a reasoning trace , a mathematical DP model , executable code , and a final numeric answer ; the paper defines a full solution as , with and denoting the correct solution and answer (Zhou et al., 15 Jul 2025). The model was proposed because DP formulation remains a crucial but manual step in operations research, operations management, and decision-making under uncertainty, and because DP problems involve sequential decisions over time, state transitions, and often stochastic dynamics, making them harder than the deterministic LP/MIP-style modeling targeted by earlier optimization-oriented LLM systems (Zhou et al., 15 Jul 2025).
1. Problem setting and formal task
DPLM is designed for a task the paper calls auto-formulate: transforming a natural-language DP problem into a complete solution trajectory comprising reasoning, model specification, code, and the final answer (Zhou et al., 15 Jul 2025). The reported motivation is that existing LLM-based optimization tools work reasonably well for deterministic LP/MIP-style modeling, whereas DP requires Bellman-style sequential reasoning about what happens first, what state the system is in, what action is chosen, how the next state evolves, and how uncertainty affects future reward or cost (Zhou et al., 15 Jul 2025).
The paper represents a DP model abstractly as
where is the horizon, 0 the state space, 1 the action space, 2 the transition probabilities, 3 the reward or cost, and 4 the discount factor (Zhou et al., 15 Jul 2025). It also reproduces standard Bellman forms, including the finite-horizon recurrence
5
with terminal condition
6
the infinite-horizon discounted equation
7
and the long-run average criterion
8
These definitions situate DPLM as a model for recovering formal sequential-decision structure from text rather than merely generating algebraic optimization templates. A plausible implication is that the task couples semantic parsing, stochastic control formalization, and executable synthesis more tightly than earlier natural-language-to-optimization systems.
2. DP-Bench and the evaluation regime
The paper introduces DP-Bench as the first standardized benchmark for DP formulation from natural language (Zhou et al., 15 Jul 2025). The benchmark contains 132 textbook-level DP problems, divided into 90 easy and 42 hard instances (Zhou et al., 15 Jul 2025). The easy problems are mainly from Winston (Operations Research), and the hard problems are mainly from Puterman (Markov Decision Processes) (Zhou et al., 15 Jul 2025). Each problem has a specific numeric answer, which enables execution-based evaluation of formulation quality, coding correctness, and end-to-end problem solving (Zhou et al., 15 Jul 2025).
The hard split is described as structurally different rather than merely longer. It contains fewer finite-horizon problems, more infinite-average-horizon problems, and far fewer deterministic problems (Zhou et al., 15 Jul 2025). The paper reports that deterministic problems constitute 45.6% of the easy set and 4.8% of the hard set (Zhou et al., 15 Jul 2025). This supports the paper’s argument that DP-Bench probes stochastic sequential reasoning rather than only textbook pattern matching.
The benchmark also serves as evidence that prior optimization-modeling LLMs do not transfer well to DP. A particularly striking result concerns ORLM-LLaMA-3-8B, which achieves 0.8% pass@1 micro accuracy and 8.3% pass@10 micro accuracy on DP-Bench (Zhou et al., 15 Jul 2025). Within the paper’s framing, this result separates DP auto-formulation from the broader category of “optimization prompting” and motivates task-specific specialization.
3. Model architecture, data generation, and training
The main model is DPLM-7B, built on Qwen-2.5-7B-Instruct and then trained in two stages (Zhou et al., 15 Jul 2025). The training recipe combines supervised fine-tuning (SFT) on synthetic DP trajectories with reinforcement learning alignment using DPO or GRPO (Zhou et al., 15 Jul 2025). The paper emphasizes that DPLM is trained specifically for DP rather than only prompted, arguing that prompting alone is bounded by the base model’s abilities (Zhou et al., 15 Jul 2025).
A central component is DualReflect, the synthetic data generation framework introduced to address the scarcity of high-quality DP training data (Zhou et al., 15 Jul 2025). It begins from 91 curated seed problems, each augmented with a correct solution tuple 9, and expands these into 113K total training samples (Zhou et al., 15 Jul 2025). The paper presents DualReflect as a balance between accuracy / correctness and diversity / novelty (Zhou et al., 15 Jul 2025).
DualReflect combines two complementary procedures. Forward generation generates a new problem description 0 from a seed problem, solves it using the LLM, and then filters or refines the result; its strengths are diversity and broader coverage of DP structures, while its weaknesses are lower correctness and the possibility of incoherent or ill-posed problems (Zhou et al., 15 Jul 2025). Backward generation starts from a correct solution or code 1, perturbs it to create a new executable ground-truth solution, and then generates a matching problem description 2; its strengths are stronger correctness guarantees and more reliable supervision, while its weakness is lower diversity because it remains closer to the seed structure (Zhou et al., 15 Jul 2025).
The framework also includes Reflected CoT. When backward generation first fails to solve a generated problem, the model is shown its failed solution and the correct reference code, then asked to reflect and revise its reasoning (Zhou et al., 15 Jul 2025). The paper reports that Reflected CoT recovers about 19.1% of samples that would otherwise be discarded, including about 20.8% of new problems that initially fail to produce a correct solution (Zhou et al., 15 Jul 2025). This mechanism is important because it increases both dataset size and the supply of reasoning trajectories suitable for supervision.
The learning objectives are explicitly given. SFT is described as approximately minimizing
3
implemented in practice as standard maximum-likelihood training on synthetic trajectories (Zhou et al., 15 Jul 2025). The paper also provides the DPO objective
4
and a GRPO objective with clipping and KL regularization (Zhou et al., 15 Jul 2025). Reward shaping is defined as
5
where executable and well-typed output receives 0.2 format reward, failure receives 0, a correct answer receives 0.8, and an incorrect answer receives 0 (Zhou et al., 15 Jul 2025).
4. Empirical performance and scaling behavior
The reported headline result is that DPLM-7B-SFT-GRPO achieves 65.6 on easy problems, 38.1 on hard problems, 56.8 micro, and 51.9 macro (Zhou et al., 15 Jul 2025). For comparison, the paper reports DeepSeek-R1 at 73.3 easy, 28.6 hard, 59.1 micro, 51.0 macro; o1 at 57.8 easy, 31.0 hard, 50.0 micro, 44.4 macro; and GPT-4o at 45.6 easy, 19.0 hard, 37.1 micro, 32.3 macro (Zhou et al., 15 Jul 2025). DPLM-7B-SFT-GRPO is therefore reported to beat GPT-4o, to beat o1 on hard problems, and to beat DeepSeek-R1 on hard problems, despite being a 7B model (Zhou et al., 15 Jul 2025).
The paper’s ablations assign a central role to SFT. It reports 7.6% micro accuracy for the base model and 33.3% after SFT, stating that SFT alone is much more effective than RL alone (Zhou et al., 15 Jul 2025). Starting from the SFT checkpoint, SFT 6 DPO reaches 40.2% micro, while SFT 7 GRPO reaches 56.8% micro (Zhou et al., 15 Jul 2025). GRPO is reported to be better than DPO but slower and more expensive, taking about 8× more wall time than DPO in the reported setup (Zhou et al., 15 Jul 2025).
The paper also identifies a scaling trade-off in synthetic data generation. Backward generation is better at small data scales, while forward generation becomes increasingly valuable at larger scales; eventually the hybrid approach performs best (Zhou et al., 15 Jul 2025). It further reports that performance rises strongly up to 7B, after which improvements become more gradual (Zhou et al., 15 Jul 2025). The authors interpret this as evidence that below 7B capacity is a bottleneck, whereas above 7B data volume and coverage become more limiting (Zhou et al., 15 Jul 2025).
Taken together, these results are presented as evidence that specialization plus task-specific synthetic data can rival or exceed much larger general models on DP auto-formulation (Zhou et al., 15 Jul 2025). This suggests that the bottleneck for DP reasoning is not only generic model scale, but also the availability of appropriately structured training trajectories.
5. Relation to dynamic-programming formalization
Although DPLM is an LLM for DP auto-formulation, its target domain is illuminated by algebraic work on DP specification and derivation. A relevant background paper presents dynamic programming as evaluation of a semiring-valued specification over the set of all combinatorial configurations and derives efficient implementations through shortcut fusion (Little et al., 2021). In that formulation, many DP tasks are written as
8
where 9 is the set of all combinatorial configurations, 0 maps atomic objects into a semiring, 1 combines contributions within one configuration, and 2 aggregates over all configurations (Little et al., 2021).
The same paper describes a derivation pipeline with three stages: an exhaustive semiring specification, a generate–evaluate brute-force algorithm, and a fused efficient DP obtained through the semiring-fusion identity
3
(Little et al., 2021). It extends this pattern to constrained problems via semiring lifting and projection, and it argues that existing DP algorithms can be abstracted from their original context and repurposed (Little et al., 2021). It explicitly covers optimization, Viterbi decoding, probabilistic marginalization, logical inference, fuzzy sets, differentiable softmax, relational and provenance queries, and constrained problems such as fixed-size subsets, longest increasing subsequence, bounded alignment deviation, and event sequences with exactly 4 failures (Little et al., 2021).
This background does not describe DPLM itself, but it clarifies the formal object that an auto-formulation model must often recover from text: a state space, action space, transition law, reward structure, and an exact recurrence or equivalent specification. A plausible implication is that DPLM operates at the interface between natural-language interpretation and the broader constructive algorithmics tradition in DP.
6. Limitations and terminological ambiguity
The DPLM paper implies several limitations. Dataset coverage is still limited: DPLM lags DeepSeek-R1 on easy problems, and the authors suggest that this is due to insufficient domain coverage (Zhou et al., 15 Jul 2025). Synthetic data quality depends on the seed set: backward generation cannot escape the structure of the original seeds, so narrow seed formulations constrain diversity (Zhou et al., 15 Jul 2025). RL is computationally costly: GRPO is much more expensive than SFT and takes about 8× more wall time than DPO in the reported setup (Zhou et al., 15 Jul 2025). Execution-based evaluation is a proxy: correct final answers are used to assess formulation quality, which is reasonable for textbook problems but not a perfect measure of model understanding (Zhou et al., 15 Jul 2025).
The paper’s broader implications are correspondingly cautious. It argues that DP formulation can be automated, but only with task-specific training; that general optimization LLMs do not transfer well to stochastic sequential decision-making; that small specialized models can rival or beat much larger general models on the right benchmark; and that combining forward diversity with backward correctness may be a general recipe for other hard reasoning tasks beyond DP (Zhou et al., 15 Jul 2025).
A recurrent source of confusion is that the acronym DPLM has multiple meanings in arXiv literature. In glass physics, DPLM denotes the distinguishable-particle lattice model, a lattice-gas glass model with distinguishable particles and quenched random pair energies (Li et al., 2023). In protein modeling, DPLM denotes a family of discrete diffusion protein LLMs, including the multimodal DPLM-2 for joint sequence–structure modeling (Wang et al., 2024) and DPLM-Evo, an evolutionary discrete diffusion framework with explicit substitution, insertion, and deletion operations (Wang et al., 30 Apr 2026). In the present sense, however, Dynamic Programming LLM refers specifically to the 7B model introduced for natural-language DP auto-formulation, together with DP-Bench and DualReflect as its benchmark and synthetic-data framework (Zhou et al., 15 Jul 2025).