potentialpaper

Exact Regular-Constrained Sampling for Variable-Order Markov Generation

Francois Pachet

NeurIPS 2026

Edit this page

Or clone it with git

Run in a terminal:

Needs Git LFS. To push, use an API key from your profile as the password.

Or let your agent set it up

It checks and sets up everything: signing in, git, the clone, credentials and an SSH key.

TL;DR. Exact regular-constrained sampling for variable-order Markov generators by compiling sparse context graphs, with exact virtual data augmentation for reversible transforms.

Abstract. We study how to sample a sequence of a fixed length from a variable-order Markov model while satisfying regular constraints, such as ending with a specified symbol, placing given symbols at selected positions, or avoiding copied fragments. The model predicts each next symbol from a context of preceding symbols and backs off to a shorter context when needed. Existing belief-propagation methods solve this problem for first-order Markov chains, which use only the last symbol as context. Our contribution is an exact extension to variable-order models. We build a graph of the contexts observed in the training data and combine it with a finite automaton that checks the constraints. This retains the context needed by the predictor and yields samples from a fixed finite-memory source conditioned on the constraints. The backward pass takes time proportional to the requested sequence length times the number of reachable transitions in this combined graph. The method also supports data augmentation through reversible transformations without storing the transformed training sequences, while preserving the probabilities obtained by learning from all the copies. Exhaustive enumeration verifies the constrained probabilities, and Bach Prelude experiments demonstrate practical generation with combined musical constraints

Are you an author? Claim this paper to see who's reading it, with views and other statistics, and to write about it here.

Claim this paper
How does this paper connect to your work? Write how you built on it, compared with it or reproduced it, or add a summary, a critique or errata.
Or make it interactive:
Start writing

edit · history

DateVersionSubmitted toPDFEvidence
3 May 2026NeurIPS 2026submittedNeurIPS 2026Accept (poster)forumreviews ↓[1]PDF[1]
Missing a version?

NeurIPS 2026

Accept (poster) · 3 reviews · OpenReview

Updated 25 Nov 2026, 03:42 UTC.

Program Chairs · DecisionOpenReview ↗
Decision
Accept (poster)
Read decision
Meta-review

All three reviewers agree that the paper is technically sound, with a well-motivated algorithmic contribution validated through both proofs and experiments. The proposed sampling strategy is recognized as practical and efficient, and the paper is commended for its care around the exactness condition and honest framing of its scope.

However, reviewers collectively identify concerns around the perceived significance and novelty of the contribution, insufficient connections to prior work, and limitations in the experimental evaluation.

  1. Narrow Novelty and Significance Concerns Two reviewers explicitly raise questions about the magnitude of the contribution. One frames it as a careful specialization rather than a major algorithmic advance, while another questions how significant exact sampling is in the era of neural networks and LLMs, and whether the method generalizes beyond music generation. The practical benefit of exact sampling over approximate baselines (e.g., masking) is not clearly established.

  2. Insufficient Relation to Prior Work Multiple reviewers note that the paper does not adequately position itself relative to existing methods. The failings of first-order sampling and dense order-K methods are described as well-established in NLP, yet the paper's relationship to this body of work is unclear. Broader literature coverage of similar constraints, reversible transformations, and alternative approaches is requested.

  3. Experimental Limitations There is shared concern about the experimental evaluation:

  • Limited experiments without systematic comparison against other optimized implementations
  • Music evaluation is structural rather than musical, leaving unclear whether the method produces perceptibly better outputs
  • Questions about scalability to corpora with richer event alphabets (how large can the sparse context graph become?)
  1. Clarity Issues At least one reviewer flags undefined terms appearing late in the paper, creating unnecessary friction for readers unfamiliar with the specific notation or concepts.

Recommendations for Authors

  1. Clearly position the contribution relative to prior work: Provide a thorough comparison with existing methods (optimized WFSA/WFST implementations, suffix-automaton variants, or practical constrained decoding baselines). Explicitly state what is novel beyond a careful specialization of known techniques, and address how the method relates to similar constraint-handling strategies in the literature.

  2. Establish practical benefits over other optimized approximate baselines and neural networks/LLMs: Directly address why exact variable-order Markov sampling remains valuable despite the dominance of neural sequence models. Concrete examples of domains where exactness guarantees matter (beyond music) would strengthen this argument. Include comparisons against other optimized methods.

  3. Strengthen the experimental evaluation: Expand beyond music generation or complement it with additional domains to demonstrate generalizability. For the music experiments, consider incorporating perceptual or musical evaluation alongside structural metrics to show downstream impact.

  4. Improve early clarity of terminology: Define key terms and concepts at first use rather than later in the paper, ensuring accessibility for readers from adjacent areas who may not be familiar with the specific formalism.

Final justification

The main cause for hesitation in giving this work a higher score seems to have been the lack of connection to LLMs and neural networks. In the interest of increasing the diversity of works published at Neurips and in line with AC guidelines, I do not consider this to be an issue, but instead an asset, as this work advances the state of the art in a method that is not "in vogue" currently. Since the original concerns with the paper have been resolved and this seems to be the main issue the reviewers had with the paper, I am bumping my recommendation to "publish".

Area Chair dUUS · Meta-reviewOpenReview ↗
Read meta-review
Meta-review

All three reviewers agree that the paper is technically sound, with a well-motivated algorithmic contribution validated through both proofs and experiments. The proposed sampling strategy is recognized as practical and efficient, and the paper is commended for its care around the exactness condition and honest framing of its scope.

However, reviewers collectively identify concerns around the perceived significance and novelty of the contribution, insufficient connections to prior work, and limitations in the experimental evaluation.

  1. Narrow Novelty and Significance Concerns Two reviewers explicitly raise questions about the magnitude of the contribution. One frames it as a careful specialization rather than a major algorithmic advance, while another questions how significant exact sampling is in the era of neural networks and LLMs, and whether the method generalizes beyond music generation. The practical benefit of exact sampling over approximate baselines (e.g., masking) is not clearly established.

  2. Insufficient Relation to Prior Work Multiple reviewers note that the paper does not adequately position itself relative to existing methods. The failings of first-order sampling and dense order-K methods are described as well-established in NLP, yet the paper's relationship to this body of work is unclear. Broader literature coverage of similar constraints, reversible transformations, and alternative approaches is requested.

  3. Experimental Limitations There is shared concern about the experimental evaluation:

  • Limited experiments without systematic comparison against other optimized implementations
  • Music evaluation is structural rather than musical, leaving unclear whether the method produces perceptibly better outputs
  • Questions about scalability to corpora with richer event alphabets (how large can the sparse context graph become?)
  1. Clarity Issues At least one reviewer flags undefined terms appearing late in the paper, creating unnecessary friction for readers unfamiliar with the specific notation or concepts.

Recommendations for Authors

  1. Clearly position the contribution relative to prior work: Provide a thorough comparison with existing methods (optimized WFSA/WFST implementations, suffix-automaton variants, or practical constrained decoding baselines). Explicitly state what is novel beyond a careful specialization of known techniques, and address how the method relates to similar constraint-handling strategies in the literature.

  2. Establish practical benefits over other optimized approximate baselines and neural networks/LLMs: Directly address why exact variable-order Markov sampling remains valuable despite the dominance of neural sequence models. Concrete examples of domains where exactness guarantees matter (beyond music) would strengthen this argument. Include comparisons against other optimized methods.

  3. Strengthen the experimental evaluation: Expand beyond music generation or complement it with additional domains to demonstrate generalizability. For the music experiments, consider incorporating perceptual or musical evaluation alongside structural metrics to show downstream impact.

  4. Improve early clarity of terminology: Define key terms and concepts at first use rather than later in the paper, ensuring accessibility for readers from adjacent areas who may not be familiar with the specific formalism.

Final justification

The main cause for hesitation in giving this work a higher score seems to have been the lack of connection to LLMs and neural networks. In the interest of increasing the diversity of works published at Neurips and in line with AC guidelines, I do not consider this to be an issue, but instead an asset, as this work advances the state of the art in a method that is not "in vogue" currently. Since the original concerns with the paper have been resolved and this seems to be the main issue the reviewers had with the paper, I am bumping my recommendation to "publish".

Reviewer fM6wOpenReview ↗
Rating
4/6
Confidence
4/5
Quality
3/4
Clarity
4/4
Significance
2/4
Originality
2/4
Contribution type
general
Ethical concerns
NO or VERY MINOR ethics concerns only
Read review
Summary

The paper studies exact sampling from variable-order Markov generators under regular constraints. The motivating observation is that prior belief-propagation methods for Markov constraints assume the correct finite-state stochastic source is already available, which is straightforward for first-order Markov chains but nontrivial for variable-order/backoff generators. The paper proposes using the sparse observed context graph as the correct source state space, then composing this graph with a deterministic finite automaton representing the constraint. Backward dynamic programming on the reachable product gives exact conditional samples for a fixed finite-memory source. The main conceptual contribution is the identification and compilation of the correct finite-state source for variable-order Markov generation. The paper supports this with a small counterexample showing that first-order future-mass heuristics can produce the wrong posterior, exactness checks by enumeration, and a Bach Prelude pitch-generation experiment with final-pitch and anti-copy constraints.

Strengths and weaknesses

Pros

  1. The paper is technically clean and addresses a real gap in regular-constrained generation with variable-order Markov models. The distinction between first-order projected state, dense order-K state, and sparse observed-context state is useful, and the finite counterexample is effective: it shows that first-order future mass can not only be inaccurate but can prefer the wrong symbol.
  2. The proposed construction is conceptually simple but well motivated. Once the context graph is recognized as the right stochastic source, the product with the regular acceptor and the backward recursion follow naturally.
  3. The paper is also careful about the exactness condition: exact conditioning is for a fixed finite-memory source, while generation-time order policies such as longest-feasible backoff define a different sequential process unless encoded in the source state.

Cons

  1. The novelty is somewhat narrow. From an automata/weighted-automata perspective, the core inference algorithm is standard once the stochastic source is compiled. The paper acknowledges this, but the resulting contribution may be seen as a careful specialization rather than a major algorithmic advance.
  2. The experiments are limited. Exactness is verified only on tiny enumerated examples, and the larger experiment uses one pitch-only Bach corpus with one main family of anti-copy constraints. The paper itself notes that other corpora, determinization-heavy languages, richer symbolic event types, and memory-profile sweeps remain to be tested. There is no systematic comparison against optimized WFSA/WFST implementations, suffix-automaton variants, or practical constrained decoding baselines.
  3. The music evaluation is mostly structural rather than musical. The paper demonstrates satisfaction of anchor and anti-copy constraints, but does not evaluate perceived quality, stylistic fidelity, diversity, or failure modes. This is acceptable for an algorithmic paper, but the Bach example is a central empirical motivation, so the authors need to give either a stronger music analysis or exxperiments on other domains.
Questions

How large can the sparse context graph become on corpora with richer event alphabets, such as polyphonic symbolic music, chord symbols, or tokenized performance data? Please also address my concerns in Strengths And Weaknesses.

Limitations

yes

Final justification

The authors' response addressed my questions. I will maintain my score.

Formatting concerns

N/A

1 comment
Authors · RebuttalOpenReview ↗
Rebuttal

We thank the reviewer for the careful and high-confidence assessment, particularly for recognizing the real gap, the usefulness of the state-space distinction, and the care taken over fixed-source exactness versus generation-time order policies.

Scope of the novelty

We agree that the backward recursion and automata product are standard after the correct stochastic source has been supplied. The contribution is the missing source-identification and compilation step for variable-order/backoff generation, together with its exactness conditions. This is not only an engineering specialization:the Section 3 example proves that using a plausible but insufficient state can change the posterior dramatically. Support masking has TV distance 0.433, and first-order future weighting has TV distance about 0.900 and reverses the MAP choice. Dense order-K lifting is exact but requires up to |V|^K source states. The sparse observed-context construction gives the actual variable-order semantics while retaining data-dependent sparsity.

Scale with richer alphabets

Let N be the number of corpus events and K the maximum context order. Each corpus position contributes at most K context-continuation incidences, so the number of distinct observed contexts and distinct observed context-symbol edges is O(NK), even though the dense space contains |V|^K possible contexts. After composition, the worst-case bound is |Q||T| states and |Q||E_T| edges, but the implementation constructs only reachable product states and edges. A richer alphabet can increase branching and can make a larger fraction of that product reachable; a complex acceptor can also dominate. Thus sparsity removes the dense |V|^K dependence for a fixed corpus but does not claim immunity to corpus size, branching, or acceptor complexity.

The submitted Bach measurements provide one concrete scale point: at N=592, |V|=25, and K=6, the source has 3,587 observed contexts, while the reachable product has 1,205 states and 83,207 edges; dense lifting would expose 25^6 = 244,140,625 source states before the constraint product. BP remains below 0.10 s. The submitted horizon sweep reaches n=128 in 2.834 s and 53.6 MiB. We agree that polyphony, chord vocabularies, performance tokens, and determinization-heavy acceptors are important empirical stress tests; the paper explicitly lists these as limitations.

Comparisons

We agree that a broader optimized-baseline study would strengthen the work. As a limited post-submission check, we compared with the existing Continuator ContextBP implementation on its supported positional final-symbol constraint, reusing backward messages for 100 samples in both systems. At K=6, backward-message time is 15.506 ms for our implementation versus 34.761 ms for Continuator, and total construction, BP, and sampling time is 63.963 ms versus 80.378 ms. We omit MAXORDER in this comparison because that Continuator constraint interface does not support it. We do not present this as a comprehensive WFSA/WFST comparison.

Musical evaluation

We agree that perceptual quality, stylistic fidelity, and diversity would be necessary to claim musically superior output. The submitted paper makes no such claim: the rendered Bach sample is explicitly labeled a qualitative illustration rather than a quality evaluation. The empirical claims are structural and algorithmic - exact probabilities on enumerable cases, satisfaction of regular constraints, reachable-product size, runtime, and virtual augmentation equivalence. Tiny instances are necessary for exhaustive exactness verification; the larger experiment is used for scalability. A future application-focused study should add richer musical representations and listening or expert evaluation.

We hope this response clarifies both what the paper establishes and what it leaves open.

Reviewer xD1LOpenReview ↗
Rating
2/6
Confidence
2/5
Quality
3/4
Clarity
3/4
Significance
1/4
Originality
3/4
Contribution type
general
Ethical concerns
NO or VERY MINOR ethics concerns only
Read review
Summary

This paper address exact sampling for variable-order (VO) Markov generators under regular-constraints. Existing belief-propagation (BP) methods (Papadopoulos et al., 2015) assume a first-order Markov chain which the paper shows to be incorrect for VO generator with a counterexample. The idea is to compile the VO backoff loop into a deterministic context graph, compose it with the constraint automaton, and run the standard BP on reachable states without expanding to dense |V|^K state space. The paper separates fixed-source exact conditioning from generation-time order policies. Experiments on musical sequence generation demonstrates scalability on a Bach Prelude corpus (592 events, K≤6) with sub-100 ms BP times, and supports virtual reversible augmentation via lazy inverse-count lookup.

Strengths and weaknesses

The paper is technically sound as the proposed sparse context-state BP sampling strategy is validated by both proof and experiments. The contribution is clearly stated without overclaim. The paper is also properly motivated with the comparison with different design reference points (Table 1) and the numerical counterexample. Originality-wise, the paper clearly pointed out the limitation of existing BP methods with first-order Markov chain assumption. There are a lot of special terms that are not well-explained at the beginning which may create difficulties for readers without sufficient background in probabilistic models and music generation. My concern lies mainly in the significance. The paper should emphasize more on why the proposed method is still relevant in the era of neural network and LLMs. It’s unclear how the proposed sampling for VO Markov models can generalize beyond music generation to other constrained sequence generation problems, e.g., constrained LLM decoding which has much larger state space and horizon. The proposed method is limited to regular constraints. Also, there is no experiment showing the practical benefits of the exact sampling over approximate baselines on more problems.

Questions
  • How does this work fit into the neural network/LLM era? Can the proposed method generalize to other domains, e.g., constrained LLM decoding?
  • How much is the benefit of exact sampling over approximate baselines, e.g., masking.
Limitations

yes

Final justification

After reading all reviews and the rebuttal, I still feel the contribution of this submission is a bit insufficient at NeurIPS. The proposed algorithm is specifically designed for VO Markov models while no connection is drawn towards modern neutral network models/LLMs. There is also a lack of practical applications beyond music generation demonstrated in the submission. Therefore, I would like to keep my rating at this time.

Formatting concerns

N/A

1 comment
Authors · RebuttalOpenReview ↗
Rebuttal

We thank the reviewer for finding the paper technically sound, clearly stated, and well motivated. We address the two significance questions directly.

Relevance alongside neural networks and LLMs

We do not claim that the proposed construction is a general constrained decoder for arbitrary LLMs. It requires a finite stochastic state from which both the next-symbol distribution and state update are determined. A large neural hidden state can make exact product inference infeasible, and such models are outside the paper's stated assumptions.

The intended setting is instead finite-memory, interpretable sequence generators, especially where data are small, constraints are explicit, and reproducible probability semantics matter. Variable-order models remain useful in such settings because their contexts and counts can be inspected, edited, augmented, and audited. The method is not intrinsically musical: the same construction applies to finite-alphabet text backoff models and other finite-state sequence sources. It can also provide an exact reference distribution against which approximate constrained-decoding methods are evaluated. We will clarify this scope earlier and avoid implying direct LLM-scale applicability.

The restriction to regular constraints is deliberate. It covers fixed positions and endings, finite metrical patterns, forbidden substrings, anti-copy constraints, and finite combinations of these. Constraints requiring unbounded memory or semantic interpretation are outside scope.

Benefit over approximate masking

The paper already includes a quantitative comparison that directly answers this question. In the Section 3 integer example, the correct constrained first-symbol posterior is

P(2 | eventual acceptance) = 10/11, and P(3 | eventual acceptance) = 1/11.

A support-only mask keeps both candidates and samples locally from 10/21 and 11/21, producing TV distance 0.433 from the exact posterior. A seemingly stronger approximation multiplies the variable-order proposal by first-order future mass, but the projected state has merged histories that the variable-order source distinguishes. This approximation has TV distance about 0.900 and reverses the MAP choice. Exact context-state BP recovers 10/11 and 1/11 exactly.

This is the practical distinction: masking can prevent an immediately invalid choice, but it does not account for how much valid probability mass lies beyond each currently feasible choice. When constraints have delayed consequences, the resulting distribution can be substantially wrong even when every output satisfies the constraint. Exactness matters when preserving the source distribution conditioned on acceptance is part of the specification, rather than merely producing any valid sequence.

As an additional post-submission implementation check, we compared against the existing Continuator ContextBP implementation on its supported positional constraint. At K=6, our backward pass takes 15.506 ms versus 34.761 ms, and total time through 100 samples is 63.963 ms versus 80.378 ms. This comparison omits MAXORDER because it is unsupported by that baseline, so we regard it as limited rather than comprehensive.

We agree that broader empirical comparisons would strengthen the paper. Our central claim, however, is not superior perceptual generation or LLM-scale decoding; it is exact, sparse conditioning of a clearly specified class of finite-memory sources.

Reviewer G4fBOpenReview ↗
Rating
4/6
Confidence
1/5
Quality
3/4
Clarity
3/4
Significance
3/4
Originality
2/4
Contribution type
general
Ethical concerns
NO or VERY MINOR ethics concerns only
Read review
Summary

This work proposes an efficient sparse-graph formulation for variable order markov generation, in this case applied to small corpora symbolic music datasets. While a naiive sampling formulation for variable order markov sampling may involve computationally expensive back-off rules and other regular constraints applied after sampling from an unconstrained markov model, they instead propose to compile suffix mappings and regular constraints into the sampling graph to sparsify the graph of reachable sampling states. Sampling from the resulting graph is therefore computationally efficient while achieving the same results. The authors also demonstrate additional results incorporating reversible transforms such as pitch shifts to further reduce the state space as would be necessary for small corpora.

Strengths and weaknesses

Note: This work is not within my field of expertise, so the following review is based on my best-effort assessment. Happy to update based on any misunderstandings and feedback from other reviewers.

Strengths:

  • The theoretical framing of this work is good. It provides decent context for existing formulations, as well as guarantees provided by their formulation
  • The proposed algorithm is highly practical with regards to efficiency

Weaknesses:

  • To me, it wasn't very clear how significant the findings or proposals of this work are with respect to prior methods. The authors make it very clear that this work is not proposing a new automata or markov model formulation. Furthermore, I believe that the failings of first-order sampling and dense order-K methods, (which were great as background reference readings), are well established results in NLP fields. Ultimately, as the main contribution of this work appears to be about efficient sampling via sparse graph construction, it would help to include a more detailed related works discussion on related optimizations in the broader markov sampling literature.
Questions
  • Are there existing works in the broader literature that incorporate similar pre-compilations of suffix mappings and other constraints?
  • In the case of the reversible transformations, can these transformations themselves be sampled via the current formulation, or do they need to be manually inserted where applicable?
  • Does it make sense to add additional comparisons any text-corpora?
Limitations

Overall significance of this work compared to related literature could be stated more clearly.

Final justification

I've bumped up my rating to borderline accept. After going the other reviews and rebuttal responses, it seems clear that this work does demonstrate a narrow but practical degree of technical advancement. Given the scope of this work, I also find the limited evaluations to be sufficient for its claims. Nevertheless I strongly agree with reviewer xD1L that the impact of this work will be extremely limited given the availability of LLMs. For this reason, the highest rating I can give is a borderline accept.

Formatting concerns

no issues

2 comments
Authors · RebuttalOpenReview ↗
Rebuttal

Relation to prior work and precise novelty

The generic product of a finite-state stochastic source with a regular acceptor, followed by backward dynamic programming, is standard; the paper explicitly credits Markov-constraint/regular-BP work and weighted-automata composition (Papadopoulos et al.; Mohri; Allauzen et al.). Variable-memory models, probabilistic suffix automata, context-tree methods, and suffix data structures are also established (Rissanen; Ron et al.; Willems et al.; Begleiter et al.; Weiner/McCreight/Ukkonen).

Our claim is narrower but substantive: those two bodies of work leave implicit which stochastic state must be supplied to regular BP for a concrete variable-order/backoff generator. The paper identifies and compiles that state as the active observed context. This yields exact conditioning without either (i) projecting to the last symbol, which changes the posterior, or (ii) enumerating all |V|^K suffixes. The counterexample establishes that this choice is distributionally consequential: support-only masking has TV distance 0.433 from the target, while a first-order future-mass hybrid has TV distance about 0.900 and selects the wrong MAP symbol. Thus sparse compilation is not only a speed optimization; it is what makes the inference correspond to the stated variable-order source. We will make this relationship to the prior-work lineages more explicit.

Reversible transformations

In the submitted formulation, transformations are not manually inserted during generation and are not sampled as a separate persistent latent variable. For a finite set G of invertible transforms, each predictive row is computed by inverse lookup,

N_G(s,y) = sum_{g in G} N(g^{-1}s, g^{-1}y).

Sampling then uses the pooled predictive distribution, exactly matching a corpus in which all transformed copies were materialized. The submitted validation obtains zero difference in success mass and matching start-order masses between explicit and virtual 12-key augmentation while storing 592 rather than 7,104 events. If an application instead needs a persistent transformation identity to be sampled and retained, that identity must be included in the finite source state (or sampled in a separate hierarchical model); we do not claim that variant here.

Comparisons and non-music domains

The construction is alphabet-agnostic and applies to any finite-memory finite-alphabet source, including character or token n-gram/backoff sources. Its size depends on observed contexts rather than the semantic domain. For N corpus events and maximum order K, the number of distinct observed contexts and observed context-symbol edges is O(NK), rather than |V|^K, before composition with the acceptor. We agree that a text-corpus experiment would broaden the empirical demonstration, but it would exercise the same construction rather than change the exactness claim.

We have also performed a post-submission comparison with the existing Continuator ContextBP implementation on its supported positional final-symbol constraint. At K=6, backward-message time is 15.506 ms for our implementation versus 34.761 ms for Continuator; total construction, BP, and 100-sample time is 63.963 ms versus 80.378 ms. MAXORDER is omitted because that Continuator interface does not support it. This is a limited direct implementation comparison, and we agree that optimized WFSA/WFST comparisons are valuable future work.

We hope these clarifications establish that the novelty is not a new generic automata algorithm, but the correct sparse compilation and exact semantics for variable-order/backoff generation.

Reviewer G4fB · CommentOpenReview ↗

Thank you for clarifying my questions regarding relation to prior formulation and the application of reversible transforms. I am pretty satisfied with the responses and have a better understanding of the specific contributions of this work. I have no further questions at this time.

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Missing a submission?

Loading the discussion…