Papers › Joint Prompt Optimization of Stacked LLMs using Variational Inference

Joint Prompt Optimization of Stacked LLMs using Variational Inference

21 Jun 2023NeurIPS 2023 11arXiv:2306.12509archive 2025-07-28

Alessandro Sordoni, Xingdi Yuan, Marc-Alexandre Côté, Matheus Pereira, Adam Trischler, Ziang Xiao, Arian Hosseini, Friederike Niedtner, Nicolas Le Roux

Large language models (LLMs) can be seen as atomic units of computation mapping sequences to a distribution over sequences. Thus, they can be seen as stochastic language layers in a language network, where the learnable parameters are the natural language prompts at each layer. By stacking two such layers and feeding the output of one layer to the next, we obtain a Deep Language Network (DLN). We first show how to effectively perform prompt optimization for a 1-Layer language network (DLN-1). Then, we present an extension that applies to 2-layer DLNs (DLN-2), where two prompts must be learned. The key idea is to consider the output of the first layer as a latent variable, which requires inference, and prompts to be learned as the parameters of the generative distribution. We first test the effectiveness of DLN-1 in multiple reasoning and natural language understanding tasks. Then, we show that DLN-2 can reach higher performance than a single layer, showing promise that we might reach comparable performance to GPT-4, even when each LLM in the network is smaller and less powerful.

PaperPDFConference PDFCodeCode Syntology ran

In Syntology View this paper on Syntology: its repositories, every harvested function with whether it ran, its licence and the call to fetch it.

Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2306.12509")

Code

Syntology Ran 3 of 19 code samples harvested from 1 repository linked to this paper; 16 have no recorded run. Of those that ran: 2 ran · our draft was wrong; 1 ran · fixture could not drive it.

By repository: official repository: 19 samples from 1 repository, 3 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

microsoft/deep-language-networks officialmentioned in papermentioned on GitHub report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

19 samples harvested; 3 ran; 0 honoured the contract we drafted; 16 have no recorded run. Read from Syntology's graph 2026-09-25; that is when this build read the record, not when the samples ran.

2ran · our draft was wrong
1ran · fixture could not drive it
16unverified

Licence: 0 of the 19 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from microsoft/deep-language-networks. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

compute_pairwise_kl microsoft/deep-language-networks/dln/vi/model.py official repository ran · fixture could not drive it MIT (permissive) · 4e2d9476c7b7f5bb · report
init_prompts microsoft/deep-language-networks/projects/vi_dln/vi_main.py official repository ran · our draft was wrong MIT (permissive) · 27d7836227d45e77 · report
load_template microsoft/deep-language-networks/dln/vi/model.py official repository ran · our draft was wrong MIT (permissive) · d843b5eea08b3a77 · report
DLNTemplate microsoft/deep-language-networks/dln/vi/model.py official repository unverified MIT (permissive) · 25b3e2a5424120d2 · report
Info microsoft/deep-language-networks/dln/vi/model.py official repository unverified MIT (permissive) · a3be7a8450083a00 · report
LLM microsoft/deep-language-networks/dln/vi/model.py official repository unverified MIT (permissive) · 58142a168b50bfe8 · report
LLoss microsoft/deep-language-networks/dln/vi/model.py official repository unverified MIT (permissive) · 917d903a0020d602 · report
LogProbs microsoft/deep-language-networks/dln/vi/model.py official repository unverified MIT (permissive) · f8c95ea21f840a49 · report
LogProbsScore microsoft/deep-language-networks/dln/vi/model.py official repository unverified MIT (permissive) · f37b35b99bcbb3c0 · report
OutputClasses microsoft/deep-language-networks/dln/vi/model.py official repository unverified MIT (permissive) · 5805bad2f84aed03 · report
PosteriorSampler microsoft/deep-language-networks/dln/vi/model.py official repository unverified MIT (permissive) · a78e566e54ca2436 · report
PriorLayer microsoft/deep-language-networks/dln/vi/model.py official repository unverified MIT (permissive) · bea9ae5b3a1554ae · report
ResidualPriorLayer microsoft/deep-language-networks/dln/vi/model.py official repository unverified MIT (permissive) · 44e5112d138ac1a5 · report
ResultLogEntry microsoft/deep-language-networks/dln/vi/model.py official repository unverified MIT (permissive) · 9a68c9cffdb8207f · report
ScoreRequest microsoft/deep-language-networks/dln/vi/model.py official repository unverified MIT (permissive) · 674886d8862cc099 · report
SequentialPromptSampler microsoft/deep-language-networks/dln/vi/model.py official repository unverified MIT (permissive) · 244a56a215343711 · report
Templates microsoft/deep-language-networks/dln/vi/model.py official repository unverified MIT (permissive) · ff15cdb643c50016 · report
VILModel microsoft/deep-language-networks/dln/vi/model.py official repository unverified MIT (permissive) · b62b5074721ca0f4 · report
log_message microsoft/deep-language-networks/dln/vi/model.py official repository unverified MIT (permissive) · df0c026e50c6f1a0 · report

Tasks

Natural Language UnderstandingVariational Inference

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

Absolute Position EncodingsAdamAttentionBPEDense ConnectionsDropoutGPT-4Label SmoothingLayer NormalizationLinear LayerMulti-Head AttentionPosition-Wise Feed-Forward LayerResidual ConnectionSoftmaxTransformerVariational Inference

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections