One Proposal for Every Margin: Zero-Shot Amortized Sequential Importance Sampling for Binary Matrices

Ruishuo Chen, Weijia Li, Xun Wang, Yu Chen, Leheng Cai, Longbo Huang

Tsinghua University

Published September 28, 2026 · on the feed September 30, 2026 · ▲ 4 · arXiv 2609.35514

Other No code arXiv ↗Hugging Face ↗

The abstract

In ecology, psychometrics, and the analysis of social and financial networks, binary matrices are often analyzed conditional on their observed row and column sums, which restricts the problem to a finite sample space of matrices with the same margins. Two fundamental problems are to count this space and to sample uniformly from it. Sequential importance sampling (SIS) addresses both with independent weighted samples and an unbiased count estimator, but its efficiency depends critically on the proposal distribution. Existing proposals are analytically designed, and their accuracy can vary substantially with the margins. We show that the ideal SIS proposal, under which every weight equals the count and the variance vanishes, is exactly the policy of a generative flow network (GFlowNet) with unit reward on every matrix that has the given margins. We therefore propose MarginFlow, a framework that turns the design of the proposal into a learning problem and amortizes it across margins by exploiting their self-similarity. Every partial matrix is itself an instance with reduced margins, so one set transformer that reads the remaining margins serves every margin. We train MarginFlow on a pool of 1904 margins and evaluate it zero-shot on 1190 held-out margins, synthetic and real, from 3times3 to 870times6. On 1187 of the 1190 margins it matches or beats the best of 31 analytically designed configurations, chosen post hoc for each margin, and its median effective sample fraction is 99.8%. On the 56 margins where that best loses more than one nat of effective sample size, MarginFlow wins every one and raises the median effective sample fraction from 10.3% to 94.1%.

The Brief

3:01

A short podcast summary of the paper. Written and voiced by AI.

Transcript

One Proposal for Every Margin. Zero-Shot Amortized Sequential Importance Sampling for Binary Matrices. By Ruishuo Chen and five others, from Tsinghua University. Published on the twenty-eighth of September. No code repository is linked to it.

In ecology, in psychometrics, and in the study of social and financial networks, binary matrices are often analysed conditional on their observed row and column sums. Fixing those margins restricts the problem to a finite space: every zero-one matrix with the same margins. Two basic questions follow. How many such matrices are there, and how can one be drawn uniformly at random? Sequential importance sampling, SIS, answers both, producing independent weighted samples and an unbiased estimate of the count. Its efficiency, though, hinges on the proposal distribution. Existing proposals are designed analytically, and how accurate they are can vary substantially from one set of margins to another. A proposal that suits one set of margins can serve another poorly, which is why the comparison later in the paper picks the best hand-designed option separately for every margin.

The paper's central observation is an exact equivalence. The ideal SIS proposal, the one under which every weight equals the count and the variance vanishes, is exactly the policy of a generative flow network, a GFlowNet, whose reward is one on every matrix with the given margins. Designing a proposal therefore becomes a learning problem. Instead of a person deriving a good proposal by analysis, a network can be trained toward the ideal one, and the closer it gets, the closer every importance weight comes to the true count.

MarginFlow is the framework built on that. It amortizes the learned proposal across margins by exploiting their self-similarity. Every partially filled matrix is itself an instance of the same problem, with reduced margins. So one set transformer, reading the margins that remain, can serve every margin rather than being retrained for each. Filling in the matrix piece by piece keeps producing smaller versions of the same question, and the same network answers each of them, which is what lets it handle margins it never saw in training.

MarginFlow is trained on a pool of one thousand nine hundred and four margins, then evaluated zero-shot on one thousand one hundred and ninety held-out margins, synthetic and real. Their sizes run from three by three up to eight hundred and seventy by six. On all but three of those held-out margins, it matches or beats the best of thirty-one analytically designed configurations, even though that best is chosen after the fact for each margin. Its median effective sample fraction is ninety-nine point eight percent.

The hard cases sharpen the picture. There are fifty-six margins where that post hoc best loses more than one nat of effective sample size. MarginFlow wins every one of them, and lifts the median effective sample fraction there from ten point three percent to ninety-four point one percent.

The comparison was built to favour the old approach: a fresh pick of the best hand-designed proposal for every margin, made with hindsight. Against that, a single learned proposal that never saw these margins came out level or ahead almost everywhere, and far ahead exactly where the hand-built options struggled.

Paper Quest · 7 chapters · about 41 min

Play this paper

Learn it by doing: make the calls the authors made, guess the result before you see it, and defend it in a viva graded on your own words. Chapter 1 is right here.

Chapter 1 🧩 · The problem

Count every table with given sums, or draw one fairly. Harder than it sounds.

Ecologists and psychometricians judge a zero-one table against all other tables with the same row and column sums. You must count those tables and draw one uniformly at random.

The road ahead

  1. 1 · The problem ~7 min Counting and fairly sampling zero-one tables with fixed row and column sums depends on a proposal, and hand-made proposals work well on some sums and badly on others.
  2. 2 · What came before ~3 min
  3. 3 · The key idea ~9 min The perfect proposal is exactly a GFlowNet policy with reward one on valid tables, so it can be learned, and one network can serve all sums.
  4. 4 · Choose your own research ~3 min
  5. 5 · Build the method ~8 min Recast the ideal proposal as a GFlowNet policy, train one set transformer on many sums, sample tables row by row, and count with importance weights.
  6. 6 · The experiment ~6 min You’ll guess: On the hardest margins, where even the best hand-designed configuration struggles, what median effective sample fraction did MarginFlow reach?
  7. 7 · The viva ~5 min Three questions from the examiners, answered in your own words. Win it for the paper’s trophy.
Join free to play the whole quest ›

Free, with Google or an email address. Your stars and progress are kept.

KipQuest: the day’s AI research, as podcasts and quests. All papers Android app Privacy Contact Episodes are written and voiced by AI from each paper. Summaries can contain mistakes: the paper is the source.