I need max score, atleastr 2.4M+ give // LDPC dec...
Creado el: 2 de diciembre de 2026
Respondido usando GPT-6.2 Thinking por Chat01
Creado el: 2 de diciembre de 2026
Respondido usando GPT-6.2 Thinking por Chat01
I need max score, atleastr 2.4M+ give
// LDPC decoding by Simulated Bifurcation (SB) with trained (deep-unfolded) hyper-parameters.
//
// Spins. One spin per information bit k: position x_k in [-1,1] and momentum y_k. Nothing else is part of
// the state; in particular there are no per-edge variables. The parity bit of check c is not a spin: it
// enters the cost function only through the constant t_c = tanh(r_c / 2) of its channel value r_c.
//
// Force. The force on spin k is a function of the current positions {x_j} only:
// f_k = xi(t) C_k + lam(t) * sum over the checks c of bit k of F'{c->k},
// F'{c->k} = 2 atanh( t_c * prod_{j in c, j != k} tanh(beta x~{j,c}) ),
// x~{j,c} = x_j - alpha * F_{c->j}(x) / (2 beta),
// F_{c->j}(x) = 2 atanh( t_c * prod_{i in c, i != j} tanh(beta x_i) ).
// Own-contribution correction inside the product: for each check c and member j a temporary value x~{j,c} is
// formed from the current positions only; F{c->j}(x) is the plain product force evaluated at the current
// positions x (not at x~), alpha is a trained constant. x~ is computed inside one force evaluation and then
// discarded: it is not a state variable, it is not carried to the next evaluation, and there is no inner
// iteration. f_k is therefore an explicit closed-form function of the current positions {x_i}. The subtraction
// removes, to first order, the part of x_j that came from check c itself.
// Channel term C_k: exact 16-QAM symbol likelihood as the channel cost. The two bits (a, b) of one PAM-4 symbol
// with received value y are not independent given y. If both are information bits (spins), the partner enters
// through its current position: P(b = 0) = (1 + tanh(beta x_b)) / 2,
// C_a = log [ sum_b P(b) p(y | a=0, b) ] - log [ sum_b P(b) p(y | a=1, b) ].
// This depends on x_b only, keeps no state and contains no check product. For x_b = 0 it equals the given LLR r_a.
// y is recovered from the given LLRs and the SNR; if that recovery is not consistent with the input (other
// modulation), C_k = r_k is used. Parity bits are untouched: t_c always uses the given LLR.
//
// SB evolution, 50 steps, every spin updated exactly once per step (inelastic walls at |x| = 1):
// y_k <- keep(t) y_k + dt(t) c_k * ( -(1 - p(t)) x_k + f_k / (2 beta) )
// x_k <- x_k + dt(t) y_k ; if |x_k| > 1 : x_k = sign(x_k), y_k = 0
// Within a step the spins are updated in G interleaved groups and the force is re-evaluated from the
// current positions before each group. c_k = d_k^(-dexp) is a per-bit scale (d_k = number of checks of bit k).
// dt, keep, p, xi, lam (piecewise linear in t), beta, alpha, dexp and the initial scale x0s are hyper-parameters
// trained offline per code length / rate (table below).
//
// Initial guesses. R <= 6 initial guesses per codeword, each evolved for 50 steps on its own; no guess uses
// the state or the result of another one, and every one of the R guesses is always evolved:
// guess 0: x_k(0) = clip(x0s r_k / (2 beta)), y_k(0) = 0
// guess 1..5: the same plus a fixed pseudo-random offset of x(0), y(0) (amplitude x0n)
// R is the same for all codewords of an input; it is 6 unless a timing probe on the first codewords shows
// that 6 would not fit the time limit, in which case it is lowered for the remaining codewords. R never
// depends on how well any guess decoded.
// Output: among the R final states, the one whose codeword has the lowest cost, i.e. the highest exact likelihood
// sum over symbols of log p(y | its two bits) (the Ising energy -sum_i r_i sigma_i if y could not be recovered).
// sigma_k = sign(x_k); parity bits are re-encoded from the information bits. No post-processing.
#include <bits/stdc++.h>
using namespace std;
// ---- simulated-bifurcation decoder: product check force with own-contribution correction + exact 16-QAM symbol likelihood as channel cost ----
struct Graph{ int N,M,E,S,W; vector<int> slot,pads; // slot[jM+m]: spin in position j of check m (-1: none)
vector<int> cs, es, fold, spinOf, varOf, deg; vector<vector<int>> rows;
// spins = bits that occur in >=2 checks (the information bits); the bit that occurs in exactly one check
// (its parity bit) enters that check only through t_c = tanh(r/2)
void build(int N_,const vector<vector<int>>&rw){ N=N_; M=rw.size(); rows=rw; vector<int> dg(N,0); for(auto&r:rw) for(int v:r) dg[v]++;
fold.assign(M,-1); cs.assign(M+1,0); es.clear(); spinOf.assign(N,-1); varOf.clear(); deg.clear();
for(int m=0;m<M;m++){ for(int v:rw[m]){ if(dg[v]==1&&fold[m]<0){ fold[m]=v; continue; } if(spinOf[v]<0){ spinOf[v]=varOf.size(); varOf.push_back(v); deg.push_back(0);} es.push_back(spinOf[v]); deg[spinOf[v]]++; } cs[m+1]=es.size(); }
E=es.size(); S=varOf.size();
W=1; for(int m=0;m<M;m++) W=max(W,cs[m+1]-cs[m]); slot.assign((size_t)WM,-1); pads.clear();
for(int m=0;m<M;m++) for(int j=0;j<W;j++){ if(cs[m]+j<cs[m+1]) slot[(size_t)jM+m]=es[cs[m]+j]; else pads.push_back(jM+m); }
ps.assign(S+1,0); for(int e=0;e<WM;e++) if(slot[e]>=0) ps[slot[e]+1]++; for(int k=0;k<S;k++) ps[k+1]+=ps[k];
pe.resize(E); { vector<int> c(ps.begin(),ps.end()-1); for(int e=0;e<WM;e++) if(slot[e]>=0) pe[c[slot[e]]++]=e; }
pt.assign(S,-1); sb.assign(S,0); odd.assign(S,0); for(int k=0;k<S;k++){ int v=varOf[k], pv=v^1; if(pv<N&&spinOf[pv]>=0) pt[k]=spinOf[pv]; sb[k]=2*(v&~1); odd[k]=v&1; } }
vector<int> ps, pe; // pe[ps[k]..ps[k+1]): positions jM+m of spin k in its checks
vector<int> pt, sb; vector<char> odd; // pt[k]: the spin that shares a PAM-4 symbol with spin k (-1: none); sb[k]: offset of that symbol's table; odd[k]: bit index is odd
};
struct Sched{ float dt[50], keep[50], p[50], xi[50], lam[50]; float beta, dexp; int groups=1; float x0n=0; float x0s=0; float alpha=0; };
static inline float clampf(float v,float lo,float hi){ v=v<lo?lo:v; v=v>hi?hi:v; return v; }
static inline float flog(float x){ uint32_t i; memcpy(&i,&x,4); int e=(int)(i>>23)-127; i=(i&0x7FFFFFu)|0x3F800000u; float m; memcpy(&m,&i,4); float t=(m-1.0f)/(m+1.0f), t2=tt; return (float)e0.69314718f+2.0ft*(1.0f+t2*(0.33333333f+t2*(0.2f+t2*(0.14285714f+t20.11111111f)))); }
static inline float ftanhb(float v){ v=clampf(v,-4.97f,4.97f); float a=vv; return v*(135135.0f+a*(17325.0f+a*(378.0f+a)))/(135135.0f+a*(62370.0f+a*(3150.0f+a28.0f))); }
// Symbol likelihoods. The two bits (i, i+1), i even, are carried by one PAM-4 symbol: level (b_i ? -1 : 1) * (b_{i+1} ? 1 : 3) / sqrt(10),
// noise variance s2 = 0.5 * 10^(-SNR/10). The received value y of every symbol is recovered from the given LLR of bit i
// (monotone in y) and checked against the given LLR of bit i+1; we[2i + 2 b_i + b_{i+1}] = p(y | b_i, b_{i+1}) / max, wl = log of it.
struct Demap{ bool ok=false; vector<float> we, wl; vector<double> ty,tf; double tsnr=-1e9;
static double fm(double y,double d,double s2){ double a=-(y-d)(y-d)/(2s2), b=-(y-3d)(y-3d)/(2s2), e=-(y+d)(y+d)/(2s2), f=-(y+3d)(y+3d)/(2s2); double m1=max(a,b), m2=max(e,f); return m1+log(exp(a-m1)+exp(b-m1)) - m2-log(exp(e-m2)+exp(f-m2)); }
static double fl(double y,double d,double s2){ double a=-(y-d)(y-d)/(2s2), b=-(y-3d)(y-3d)/(2s2), e=-(y+d)(y+d)/(2s2), f=-(y+3d)(y+3d)/(2s2); double m1=max(b,f), m2=max(a,e); return m1+log(exp(b-m1)+exp(f-m1)) - m2-log(exp(a-m2)+exp(e-m2)); }
void init(const floatL,int N,double snr){ ok=false; if(N%2) return; double s2=0.5pow(10.0,-snr/10), d=1/sqrt(10.0); we.resize(2N); wl.resize(2N); double bad=0;
const int NT=8192; if(tsnr!=snr){ tsnr=snr; ty.resize(NT); tf.resize(NT); for(int i=0;i<NT;i++){ ty[i]=-6+12.0i/(NT-1); tf[i]=fm(ty[i],d,s2); } }
for(int i=0;i<N;i+=2){ double t=L[i],y; if(t<=tf[0]){ y=-6; bad+=1; } else if(t>=tf[NT-1]){ y=6; bad+=1; } else { int lo=0,hi=NT-1; while(hi-lo>1){ int mid=(lo+hi)>>1; if(tf[mid]<t) lo=mid; else hi=mid; } y=ty[lo]+(ty[hi]-ty[lo])(t-tf[lo])/(tf[hi]-tf[lo]); }
if((i&14)==0){ double pr=fl(y,d,s2); if(fabs(pr-L[i+1])>0.02+0.01fabs(pr)) bad+=8; }
double l4[4], mx=-1e300; for(int b0=0;b0<2;b0++) for(int b1=0;b1<2;b1++){ double lev=(b0?-1:1)(b1?1:3)d; l4[b02+b1]=-(y-lev)(y-lev)/(2s2); mx=max(mx,l4[b02+b1]); }
for(int q=0;q<4;q++){ wl[2i+q]=(float)(l4[q]-mx); we[2i+q]=(float)exp(l4[q]-mx); } }
ok = bad < 0.002N; }
};
#if defined(GNUC) && !defined(clang)
#if defined(x86_64)
#define HOT attribute((optimize("O3"),target_clones("avx2","default")))
#else
#define HOT attribute((optimize("O3")))
#endif
#else
#define HOT
#endif
#define RS __restrict
HOT static void vTanh1(int n,const floatRS a,floatRS m){ for(int i=0;i<n;i++) m[i]=ftanhb(a[i]); }
HOT static void vLog(int n,const floatRS a,floatRS u){ for(int i=0;i<n;i++) u[i]=flog(a[i]); }
// sc[e] = tanh( beta x~ ), beta x~ = beta x_j - (alpha/2) * 2 atanh(q[e]), h[e] = beta x_j
HOT static void vCorr(int n,const floatRS h,const floatRS q,float ha,floatRS sc){ for(int e=0;e<n;e++){ float v=clampf(q[e],-0.9999f,0.9999f); float u=flog((1.0f+v)/(1.0f-v)); sc[e]=ftanhb(h[e]-hau); } }
// q[j][m] = tp[m] * product of s[i][m] over i != j
HOT static void vOthers(int M,int W,const floatRS s,const floatRS tp,floatRS q,floatRS suf){
for(int m=0;m<M;m++) q[m]=tp[m];
for(int j=0;j+1<W;j++){ const floatsj=s+(size_t)jM; const floatqj=q+(size_t)jM; floatqn=q+(size_t)(j+1)M; for(int m=0;m<M;m++) qn[m]=qj[m]sj[m]; }
for(int m=0;m<M;m++) suf[m]=1.0f;
for(int j=W-1;j>=0;j--){ const floatsj=s+(size_t)jM; floatqj=q+(size_t)jM; for(int m=0;m<M;m++){ qj[m]=suf[m]; suf[m]=sj[m]; } } }
struct Work{ vector<float> x,y,tp,dsc,tot,s,q,suf,ra,ub,cb,cm,mm,rc,lcv,lc,hE,s2,q2; };
static inline uint32_t xs32(uint32_t&s){ s^=s<<13; s^=s>>17; s^=s<<5; return s; }
static inline float gauss(uint32_t&s){ float a=0; for(int i=0;i<4;i++) a+=(float)(xs32(s)>>8)(1.0f/16777216.0f); return (a-2.0f)1.7320508f; }
// One trajectory: T steps from initial guess number seed (0: channel values only; >0: plus a fixed pseudo-random offset).
// Force on spin k, evaluated directly from the current positions x (nothing else enters, nothing is kept between steps):
// U_k = sum over the checks c of bit k of F'{c->k},
// F'{c->k} = 2 atanh( t_c * prod_{j in c, j != k} tanh(beta x~{j,c}) ), x~{j,c} = x_j - alpha * F_{c->j}(x) / (2 beta),
// F_{c->j}(x) = 2 atanh( t_c * prod_{i in c, i != j} tanh(beta x_i) ) (evaluated at the current positions x),
// x~ is a temporary of this one force evaluation: it is not stored, not carried to the next evaluation and not iterated.
// alpha = 0 gives the plain product force.
// C_k = channel term: gradient of the exact symbol log-likelihood. If the bit b that shares the symbol of bit k is
// also a spin, P(b=0) = (1 + tanh(beta x_b)) / 2 and
// C_k = log sum_b P(b) p(y | k=0, b) - log sum_b P(b) p(y | k=1, b);
// otherwise (or if we is null) C_k = r_k, the given LLR.
// Implementation: s = tanh(beta x_j) for every member of every check; q = t_c * product over the other members
// (= tanh(F_{c->j}/2)); s2 = tanh(beta x~_{j,c}); q2 = t_c * product of s2 over the other members;
// since 2 atanh(q) = log((1+q)/(1-q)), the sum over the checks of a bit is taken as one log of a product.
static void sbRun(const Graph&g,const floatL,const floatwe,const Sched&sc,int T,Work&w,uint32_t seed=0){
int S=g.S,M=g.M,N=g.N,W=g.W,EP=WM; w.x.assign(S,0); w.y.assign(S,0); w.tot.resize(N); w.dsc.resize(S); w.tp.resize(M);
w.s.assign(EP,1.0f); w.q.resize(EP); w.hE.assign(EP,0.0f); w.s2.resize(EP); w.q2.resize(EP); w.suf.resize(M); w.ra.resize(S); w.ub.resize(S); w.cb.resize(S); w.cm.resize(S); w.mm.resize(S); w.rc.resize(S); w.lcv.resize(S); w.lc.resize(S);
floatx=w.x.data(),y=w.y.data(),s=w.s.data(),q=w.q.data(),ra=w.ra.data(),ub=w.ub.data(),cb=w.cb.data(),cm=w.cm.data(),mm=w.mm.data(),rc=w.rc.data(),lcv=w.lcv.data(),lc=w.lc.data(); const intpt=g.pt.data(),sb=g.sb.data(); const charodd=g.odd.data();
const intps=g.ps.data(),pe=g.pe.data();
for(int m=0;m<M;m++){ int f=g.fold[m]; if(f<0){ w.tp[m]=1.0f; continue; } float v=0.5fL[f]; float r=ftanhb(v); r= v>4.97f?1.0f:r; r= v<-4.97f?-1.0f:r; w.tp[m]=r; }
for(int k=0;k<S;k++) w.dsc[k]=powf((float)g.deg[k],-sc.dexp);
if(sc.x0s!=0){ float c=sc.x0s0.5f/sc.beta; for(int k=0;k<S;k++){ float v=cL[g.varOf[k]]; x[k]= v>1?1:(v<-1?-1:v); } }
if(seed&&sc.x0n>0){ uint32_t rs=seed2654435761u+12345u; for(int k=0;k<S;k++){ x[k]+=sc.x0ngauss(rs); y[k]=sc.x0ngauss(rs); } }
const float beta=sc.beta, ib=0.5f/beta;
const int G=sc.groups<1?1:sc.groups;
for(int k=0;k<S;k++) cb[k]=betax[k];
floathE=w.hE.data(),s2=w.s2.data(),q2=w.q2.data(); const float ha=0.5fsc.alpha;
vTanh1(S,cb,cm); for(int k=0;k<S;k++){ float m=cm[k]; mm[k]=m; for(int i=ps[k];i<ps[k+1];i++){ s[pe[i]]=m; hE[pe[i]]=cb[k]; } }
for(int t=0;t<T;t++){
float dt=sc.dt[t],keep=sc.keep[t],pm=1-sc.p[t],xi=sc.xi[t]ib,lam=sc.lam[t]ib;
for(int gi=0;gi<G;gi++){
vOthers(M,W,s,w.tp.data(),q,w.suf.data()); const floatqq=q;
if(ha>0){ vCorr(EP,hE,q,ha,s2); for(int e:g.pads) s2[e]=1.0f; vOthers(M,W,s2,w.tp.data(),q2,w.suf.data()); qq=q2; }
int n=0; bool big=false;
for(int k=gi;k<S;k+=G,n++){ int a=ps[k],b=ps[k+1]; if(b-a>8){ big=true; float u=0; for(int i=a;i<b;i++){ float v=clampf(qq[pe[i]],-0.9999f,0.9999f); u+=flog((1.0f+v)/(1.0f-v)); } ra[n]=1.0f; cb[n]=u; continue; }
float nu=1,de=1; for(int i=a;i<b;i++){ float v=clampf(qq[pe[i]],-0.9999f,0.9999f); nu=1.0f+v; de=1.0f-v; } ra[n]=nu/de; cb[n]=0; }
vLog(n,ra,ub); if(big) for(int i=0;i<n;i++) ub[i]+=cb[i];
n=0;
for(int k=gi;k<S;k+=G,n++){ int pk= we? pt[k] : -1; if(pk<0){ rc[n]=1.0f; lcv[n]=L[g.varOf[k]]; continue; }
const floatq4=we+sb[k]; float mp=mm[pk], P0=0.5f+0.5fmp, P1=0.5f-0.5fmp, nu,de; if(!odd[k]){ nu=P0q4[0]+P1q4[1]; de=P0q4[2]+P1q4[3]; } else { nu=P0q4[0]+P1q4[2]; de=P0q4[1]+P1q4[3]; } rc[n]=(nu+1e-30f)/(de+1e-30f); lcv[n]=0; }
vLog(n,rc,lc);
n=0;
for(int k=gi;k<S;k+=G,n++){ float gg=xi(lcv[n]+lc[n])+lamub[n]; float yy=keepy[k]+dtw.dsc[k](gg-pmx[k]); float xx=x[k]+dtyy; if(xx>1){xx=1;yy=0;} else if(xx<-1){xx=-1;yy=0;} x[k]=xx; y[k]=yy; cb[n]=betaxx; }
vTanh1(n,cb,cm); n=0;
for(int k=gi;k<S;k+=G,n++){ float m=cm[n],hb=cb[n]; mm[k]=m; for(int i=ps[k];i<ps[k+1];i++){ s[pe[i]]=m; hE[pe[i]]=hb; } }
}
}
for(int v=0;v<N;v++) w.tot[v]=L[v];
for(int k=0;k<S;k++) w.tot[g.varOf[k]]=x[k];
}
// hard decision of the spins, parity bits re-encoded from them; returns the cost of the codeword:
// minus its exact log-likelihood, -sum over symbols of log p(y | its two bits) (wl given), else the Ising energy -sum_i r_i sigma_i
static double finishWord(const Graph&g,const floatL,const floatwl,const floattot,vector<char>&u){
int N=g.N; u.resize(N); for(int v=0;v<N;v++) u[v]=tot[v]<0;
double En=0; for(int m=0;m<g.M;m++){ int f=g.fold[m]; int par=0; for(int v:g.rows[m]) if(v!=f) par^=u[v]; if(f>=0) u[f]=par; else if(par) En+=50; }
if(wl){ for(int i=0;i+1<N;i+=2) En-=wl[2i+2u[i]+u[i+1]]; }
else { for(int v=0;v<N;v++){ En+= u[v]? L[v] : -L[v]; } }
return En; }
static const int KN=7, NS=5, NPAR=NSKN+6;
struct Entry{ int N,num,den,w,groups,kind; double v[NPAR]; }; // w: column weight of the information bits the row was trained for; kind 0: row for guess 0, 1: row for guesses 1..5
static const Entry TAB[]={
{648,1,2,6,6,0,{0.3687,0.5537,0.6116,0.8097,0.8871,0.7183,0.4654,0.3331,0.4580,0.7200,0.5754,0.5817,0.4480,0.5259,0.1166,0.0638,-0.0030,0.1567,0.2252,0.1111,0.0253,1.4426,1.2161,0.9595,0.9634,1.0198,0.9059,0.9603,1.1357,1.0833,1.0324,0.9316,0.8041,0.9501,0.9714,6.9071,0.0000,0.0068,0.7008,1.0270,0.2000}},
{648,1,2,6,6,1,{0.7099,0.6157,0.7047,0.8129,0.9731,0.8276,0.5482,0.2134,0.4220,0.5745,0.5436,0.4877,0.4633,0.4041,0.2611,0.0777,-0.0138,0.1152,0.2429,0.0724,0.0280,1.4743,1.2042,1.0110,0.9818,0.9894,0.9100,0.9196,1.2645,1.1234,1.0466,0.9145,0.7839,0.9026,0.9698,6.5901,0.0000,0.0000,0.6714,1.0195,0.3000}},
{648,2,3,3,6,0,{0.8438,0.7446,0.6858,0.9540,0.6113,1.2142,0.8969,0.0056,0.0255,0.2594,0.4219,0.1968,0.4787,0.0383,-0.0426,-0.2501,-0.0234,-0.3733,-0.0488,0.2182,0.3412,0.6394,0.7491,0.8624,1.2192,0.6428,0.7613,1.0685,0.8809,1.0765,0.9169,0.9460,0.8543,0.7373,1.0191,8.9624,0.0000,0.0000,0.6399,0.0000,0.2000}},
{648,2,3,3,6,1,{0.8619,0.7971,0.7294,1.1177,0.5937,1.1905,0.8850,0.0000,0.0000,0.4440,0.4306,0.1019,0.4323,0.0392,-0.0056,-0.1804,-0.1680,-0.4216,-0.0765,0.2255,0.2645,0.7564,0.8578,0.9935,1.3064,0.5562,0.9105,1.1602,1.0651,1.2077,1.0691,1.1457,0.9724,0.8537,1.2283,8.3205,0.0000,0.0642,0.7387,0.1685,0.2384}},
{648,3,4,2,6,0,{0.7081,0.7292,0.6836,0.8883,0.5405,1.0886,0.9635,0.0037,0.0100,0.0520,0.2453,0.1659,0.3504,0.0223,0.0631,-0.2122,-0.0051,-0.3029,0.0196,0.3358,0.3760,0.7709,0.7280,0.9246,1.2683,0.6803,0.7494,1.0257,0.7497,1.0602,0.7512,0.8420,0.8622,0.7329,1.0657,8.2710,0.0000,0.0000,0.6383,0.2516,0.2000}},
{648,3,4,2,6,1,{0.6809,0.7237,0.6459,0.9099,0.5300,1.1253,0.9540,0.0040,0.0428,0.0000,0.0000,0.1147,0.3301,0.0000,0.1254,-0.2329,-0.0364,-0.2918,-0.0232,0.4035,0.3713,0.7502,0.7247,0.8701,1.2172,0.7037,0.7334,1.0152,0.7209,1.1115,0.7622,0.8586,0.8673,0.7851,1.0289,8.2603,0.0000,0.0000,0.6576,0.4202,0.3192}},
{1296,1,2,6,6,0,{0.3434,0.5803,0.5992,0.7599,0.9191,0.8580,0.4903,0.3816,0.4760,0.7113,0.5348,0.4573,0.4462,0.6200,0.0886,0.0488,-0.0372,0.1516,0.2168,0.2374,0.0604,1.5805,1.3259,1.1221,1.0186,0.9073,0.9088,1.0915,1.2487,1.1110,1.0741,0.8903,0.7864,0.7958,1.0281,6.9209,0.0000,0.0000,0.6935,0.8662,0.2000}},
{1296,1,2,6,6,1,{0.5357,0.6066,0.6158,0.7072,0.9123,0.8893,0.4831,0.5342,0.5814,0.6686,0.6380,0.5636,0.3839,0.6690,0.1183,0.1860,-0.0529,0.1534,0.2413,0.1762,0.0922,1.5578,1.3556,1.1523,1.1261,0.9849,0.9421,1.1627,1.3223,1.1033,1.0055,0.9715,0.8233,0.8147,1.0057,7.2041,0.0000,0.0000,0.6708,0.8295,0.3360}},
{1296,2,3,3,6,0,{0.7633,0.7900,0.7288,0.9854,0.7660,1.1733,0.8910,0.0000,0.0657,0.1936,0.2221,0.1815,0.3422,0.0299,0.0343,-0.2918,0.0659,-0.3404,0.0559,0.3091,0.3735,0.6141,0.6949,0.8684,1.1852,0.7094,0.7478,1.0769,0.8691,1.1022,0.8910,0.8792,1.0560,0.7607,1.0602,8.7698,0.0000,0.0674,0.6668,0.0000,0.2000}},
{1296,2,3,3,6,1,{0.7872,0.6467,0.5631,0.9119,0.6624,1.1251,0.9694,0.0000,0.0082,0.2405,0.6787,0.0452,0.4733,0.0000,0.0520,-0.3354,0.0325,-0.3800,-0.0862,0.2502,0.3106,0.6152,0.8128,1.0233,1.1851,0.8719,0.8406,1.1339,0.9819,1.2098,0.9751,0.9725,0.9430,0.8742,1.0522,8.0578,0.0000,0.0721,0.6766,0.1735,0.2768}},
{1296,3,4,2,6,0,{0.7324,0.7049,0.6885,0.9044,0.4916,1.0707,1.0200,0.0873,0.1223,0.2003,0.2798,0.2816,0.3846,0.0585,0.0781,-0.2572,-0.0515,-0.3464,0.0552,0.3116,0.4385,0.8207,0.8025,1.0136,1.2506,0.6713,0.8403,1.0581,0.7883,1.0530,0.7086,0.7660,0.9426,0.7340,1.0303,8.5838,0.0000,0.0386,0.6595,0.4401,0.2000}},
{1296,3,4,2,6,1,{0.7431,0.7988,0.7359,0.9363,0.5307,1.1109,0.9855,0.1692,0.2504,0.3054,0.4952,0.3865,0.4709,0.1797,0.0443,-0.2847,-0.0270,-0.3159,-0.0243,0.2657,0.4305,0.8786,0.8547,0.9909,1.2294,0.7392,0.9095,1.1504,0.8553,1.2095,0.7655,0.8309,1.0852,0.7883,1.0907,9.3780,0.0000,0.0000,0.7262,0.5835,0.4363}},
{1944,1,2,6,6,0,{0.4821,0.6384,0.6440,0.8242,0.9133,0.7133,0.5513,0.4646,0.4571,0.6641,0.5714,0.4549,0.5282,0.5222,0.1485,0.0633,-0.0209,0.1649,0.2105,0.2217,0.0115,1.3669,1.1997,1.0282,0.9929,0.7224,0.8706,1.0530,1.1842,1.0054,1.0264,0.8825,0.7722,0.8507,1.0444,5.4564,0.0000,0.0144,0.6909,0.8437,0.2000}},
{1944,1,2,6,6,1,{0.5221,0.5723,0.7180,0.8007,0.8958,0.8095,0.6779,0.4553,0.4793,0.6689,0.5562,0.4890,0.5165,0.5056,0.1923,0.1236,-0.0121,0.1718,0.2585,0.2432,-0.0436,1.5299,1.2152,1.0664,1.0973,0.8865,0.9384,1.2439,1.3431,1.1180,1.0529,0.8927,0.8217,0.8216,1.1181,8.5518,0.0000,0.0000,0.6991,0.9242,0.2118}},
{1944,2,3,3,6,0,{0.7971,0.7513,0.7056,0.8493,0.5936,1.1409,0.9101,0.0000,0.0000,0.1990,0.4042,0.2764,0.4422,0.0000,0.0215,-0.2281,-0.0349,-0.3522,0.0875,0.3400,0.3464,0.7073,0.7489,0.8600,1.3056,0.7184,0.7503,1.0557,0.8099,1.0513,0.8209,0.8453,0.8204,0.7375,1.0372,8.5665,0.0000,0.0000,0.6599,0.0992,0.2000}},
{1944,2,3,3,6,1,{0.8645,0.8177,0.8036,0.8645,0.6576,1.1949,0.9537,0.0164,0.0164,0.1749,0.4003,0.3318,0.4265,0.0164,0.0047,-0.2416,-0.0217,-0.2964,0.0737,0.3313,0.4005,0.7967,0.9044,1.0047,1.4000,0.8432,0.7339,1.1570,0.8034,1.0575,0.8223,0.8590,0.8363,0.7612,1.0415,8.4984,0.0000,0.0109,0.7098,0.0911,0.3137}},
{1944,3,4,2,6,0,{0.6911,0.6815,0.6635,0.9405,0.5761,1.0476,0.9696,0.0000,0.0000,0.0566,0.2340,0.1645,0.3929,0.0237,0.0657,-0.2789,0.0035,-0.3087,0.0261,0.3212,0.4297,0.7445,0.7082,0.9730,1.2426,0.6732,0.7289,1.0472,0.7221,1.0141,0.7546,0.8826,0.9104,0.7618,1.0784,6.9983,0.0000,0.0000,0.6590,0.2205,0.2000}},
{1944,3,4,2,6,1,{0.6851,0.6650,0.7209,0.9638,0.5565,1.0247,0.8970,0.2021,0.2262,0.3086,0.4838,0.4193,0.5975,0.2202,0.0999,-0.2139,0.0353,-0.2669,0.1091,0.3533,0.4537,0.8981,0.8354,1.1347,1.4046,0.8354,0.9044,1.1754,0.7148,0.9960,0.7398,0.8839,0.9307,0.7867,1.0840,7.7559,0.0000,0.0475,0.6572,0.2663,0.3077}},
{3888,1,2,6,6,0,{0.4203,0.5465,0.6529,0.7808,0.8567,0.6843,0.5547,0.4246,0.4252,0.6624,0.5060,0.5313,0.5966,0.6647,0.1091,0.0911,0.0059,0.1359,0.2185,0.2025,0.0174,1.2989,1.1648,0.9449,0.9608,0.8878,0.8278,0.9105,1.2674,1.0981,1.0241,0.8668,0.7800,0.8036,1.0945,7.1449,0.0000,0.0000,0.6851,0.9379,0.2000}},
{3888,1,2,6,6,1,{0.4304,0.5245,0.6332,0.7942,0.8624,0.7603,0.5617,0.4205,0.4560,0.6385,0.5103,0.5587,0.4416,0.6087,0.1574,0.1470,-0.0244,0.1336,0.1778,0.1707,-0.0951,1.5831,1.3743,1.1626,1.0415,1.0544,1.0226,1.0480,1.2928,1.2673,1.0514,0.9018,0.8371,0.8586,1.0998,6.6992,0.0000,0.0026,0.6844,0.9389,0.3005}},
{3888,2,3,3,6,0,{0.7755,0.7654,0.7114,0.9744,0.6019,1.1650,0.9496,0.0705,0.0053,0.2820,0.2363,0.1864,0.4336,0.0406,0.0652,-0.2481,0.0251,-0.3238,0.2792,0.3872,0.3820,0.7770,0.7021,0.8932,1.2925,0.9036,0.7337,1.1159,0.8552,1.0286,0.8035,0.7241,0.8104,0.7095,1.0749,7.9188,0.0000,0.0467,0.7000,0.1167,0.2000}},
{3888,2,3,3,6,1,{0.7367,0.7598,0.6699,0.8212,0.7878,1.1396,1.0630,0.0502,0.0176,0.3348,0.4952,0.3345,0.3578,0.2579,-0.0090,-0.2636,0.0965,-0.2611,0.1899,0.2680,0.2993,0.6922,0.7329,0.9737,1.4307,0.7447,0.6553,0.9601,0.7414,1.0142,0.7988,0.7750,0.8171,0.6864,0.9789,7.6830,0.0000,0.0000,0.8462,0.1575,0.3117}},
{3888,3,4,2,6,0,{0.7753,0.7478,0.7314,0.9473,0.5345,1.0743,1.0629,0.1645,0.1995,0.2775,0.3570,0.3588,0.4618,0.1357,0.0787,-0.2566,-0.0509,-0.3458,0.0366,0.3122,0.4391,0.8207,0.8025,0.9562,1.3329,0.6713,0.8403,1.0581,0.7706,1.0353,0.6909,0.7483,0.9249,0.7163,1.0126,8.5838,0.0000,0.0386,0.6595,0.4401,0.2000}},
{3888,3,4,2,6,1,{0.7826,0.7561,0.7017,0.9575,0.5200,0.9953,1.0627,0.1862,0.1906,0.3227,0.2301,0.3795,0.4497,0.1276,0.1070,-0.2808,-0.0557,-0.4172,0.0310,0.3105,0.4472,0.8197,0.7848,0.9071,1.3115,0.6374,0.8477,1.0392,0.7416,1.0486,0.6884,0.7128,0.9824,0.7404,1.0166,8.4867,0.0000,0.1503,0.6509,0.3805,0.2940}},
};
static Sched mk(const Entry&en){ const doublep=en.v; Sched s; for(int t=0;t<50;t++){ double f=(double)t/49*(KN-1); int i=min((int)f,KN-2); double a=f-i; auto I=[&](int k){return (float)(p[kKN+i](1-a)+p[kKN+i+1]a);}; s.dt[t]=I(0); s.keep[t]=min(1.0f,max(0.0f,I(1))); s.p[t]=I(2); s.xi[t]=I(3); s.lam[t]=I(4);} s.beta=p[NSKN]; s.dexp=p[NSKN+2]; s.x0s=p[NSKN+4]; s.groups=en.groups; s.x0n=p[NSKN+5]; s.alpha=p[NSKN+3]; return s; }
static char buf; static size_t bl, bp_;
static inline void skipws(){ while(bp_<bl && (unsigned char)buf[bp_]<=' ') bp_++; }
static inline int readInt(){ skipws(); int s=1; if(bp_<bl&&buf[bp_]=='-'){s=-1;bp_++;} int v=0; while(bp_<bl && buf[bp_]>='0'&&buf[bp_]<='9') v=v10+(buf[bp_++]-'0'); return vs; }
static inline double readD(){ skipws(); char* e; double v=strtod(buf+bp_,&e); bp_=e-buf; return v; }
#ifndef TLIMV
#define TLIMV 100.0
#endif
#ifndef RMAX
#define RMAX 6
#endif
int main(){ const double TLIM=TLIMV; // time budget in seconds
auto tStart=chrono::steady_clock::now();
size_t cap=1<<26; buf=(char*)malloc(cap+1); bl=0; size_t r;
while((r=fread(buf+bl,1,cap-bl,stdin))>0){ bl+=r; if(bl==cap){cap*=2; buf=(char*)realloc(buf,cap+1);} } buf[bl]=0; bp_=0;
int N=readInt(), K=readInt(), B=readInt(); double SNR=readD(); int M=N-K;
vector<vector<int>> rows(M);
for(int m=0;m<M;m++) for(int n=0;n<N;n++){ skipws(); if(bp_<bl&&buf[bp_]=='1') rows[m].push_back(n); while(bp_<bl&&(unsigned char)buf[bp_]>' ') bp_++; }
vector<float> LLR((size_t)BN); for(size_t i=0;i<(size_t)BN;i++) LLR[i]=(float)readD();
Graph g; g.build(N,rows);
double R=(double)K/N; long ones=0; for(auto&r:rows) ones+=r.size(); double cw=(double)(ones-M)/max(K,1); int best=0; double bd=1e9; int nT=sizeof(TAB)/sizeof(TAB[0]);
for(int i=0;i<nT;i++){ if(TAB[i].kind) continue; double d=fabs(R-(double)TAB[i].num/TAB[i].den)40+fabs(cw-TAB[i].w)4+fabs(log((double)N/TAB[i].N)); if(d<bd){bd=d;best=i;} }
int more=best; for(int i=0;i<nT;i++) if(TAB[i].kind==1&&TAB[i].N==TAB[best].N&&TAB[i].num==TAB[best].num&&TAB[i].den==TAB[best].den&&TAB[i].w==TAB[best].w) more=i;
Sched s0=mk(TAB[best]), s1=mk(TAB[more]);
auto now=&{ return chrono::duration<double>(chrono::steady_clock::now()-tStart).count(); };
Work wk; Demap dm; vector<char> u,bu; string out; out.resize((size_t)BN2);
int REP=RMAX; const int PROBE=4; double tRead=now();
for(int b=0;b<B;b++){ const floatL=&LLR[(size_t)bN]; double bE=1e300; dm.init(L,N,SNR); const floatwe= dm.ok? dm.we.data() : nullptr, wl= dm.ok? dm.wl.data() : nullptr;
for(int rp=0;rp<REP;rp++){ sbRun(g,L,we,rp?s1:s0,50,wk,rp); double En=finishWord(g,L,wl,wk.tot.data(),u); if(En<bE){ bE=En; bu.swap(u); } }
if(b+1==PROBE&&B>PROBE){ // timing probe: number of guesses that fits the time limit (independent of the decoding results)
double per=(now()-tRead)/(PROBEREP); int fit=(int)((TLIM-now())/(per(B-PROBE))); REP=max(1,min(REP,fit)); }
charo=&out[(size_t)bN2]; for(int i=0;i<N;i++){ o[2i]=bu[i]?'1':'0'; o[2*i+1]= i+1<N?' ':'\n'; } }
fwrite(out.data(),1,out.size(),stdout); return 0;
}
current sol:
The current submission (work/submit/sol_p8.cpp, 2,255,260) is a simulated-bifurcation (SB) decoder: it treats every information bit as a particle that slides between −1 and +1 and lets the code's constraints push the particles until each settles on a side.
1. Setup
2. One step of one trajectory
Each spin feels a force with two parts:
The move itself is the SB update: velocity = keep × old velocity + dt × (force − restoring pull on x), then position += dt × velocity. A spin that hits ±1 stops there with zero velocity. Within a step the spins are updated in 6 interleaved groups, so later groups already see the earlier groups' new positions; every spin still moves exactly once per step.
3. Schedule
4. Six trajectories
5. Output
Each final state is turned into bits by sign, the parity bits are re-encoded from them, and the exact likelihood of that codeword is computed. The codeword with the highest likelihood of the six is the answer. There is no other post-processing.
Compliance status of each piece
20261125 Updated: Download New Large Sample publish_20261125.zip
Download Large Sample publish.in publish.ans
Low-Density Parity-Check Decoding Algorithm Based on Quantum Annealing Inspired Algorithm
Background
Low-Density Parity-Check (LDPC) code is an important channel error correction method, widely used in fields such as Wi-Fi, 5.5G communications, and optical communications. As communication rate keeps increasing, LDPC decoding throughput is soaring, and the demand for decoding performance keeps increasing. Traditional Belief Propagation (BP) – based decoding algorithms have reached a performance bottleneck. LDPC decoding algorithms based on quantum annealing processes demonstrate potential for improving throughput, and concepts in machine learning may enhance the behavior further. Therefore, this challenge invites participants to design an LDPC decoding algorithm that integrates the Quantum Annealing Inspired Algorithm (QAIA, for more introduction to QAIA, please see appendix I) and the Deep Unfolding (DU, for more details on Deep Unfolding, please see reference [1]) framework.
Problem Statement
Given the parity-check matrix
H
H of a Low-Density Parity-Check (LDPC) code, along with the log-likelihood ratio (LLR) soft information
r
i
r
i
for each bit, you are required to design a decoding algorithm that recovers the original information bits.
The decoding algorithm must be based on the parameter-update strategy of a Quantum Annealing Inspired Algorithm (QAIA), and embedded within a Deep Unfolding (DU) framework so that the hyperparameters during iteration become trainable. Here, QAIA serves as the core decoding algorithm itself, while DU is the training/parameterization framework — the two stand in a nested relationship, not as parallel alternatives.
Your objective is to minimize the difference between the recovered bits and the original bits, where this difference is measured by the Bit Error Rate (BER). The number of iteration steps must not exceed 50 (
N
steps
≤
50
N
steps
≤50).
What is QAIA?
QAIA is a class of iterative optimization algorithms inspired by the quantum annealing process. It formulates the decoding problem as an energy minimization problem: a set of state variables is defined, among which
x
i
x
i
is the target variable to be optimized and
y
i
y
i
is an auxiliary variable. During the iterative update,
x
i
(
t
)
x
i
(t) evolves continuously and is finally discretized to either -1 or +1; through repeated iterations, the system energy decreases progressively until it approaches the optimal solution. The iterative update rule of QAIA is governed by several parameters. Taking the discrete Simulated Bifurcation (dSB) algorithm as an example, the key parameters include the time step
Δ
t
Δt, the momentum coefficient
p
(
t
)
p(t), and the control parameter
ξ
(
t
)
ξ(t). Note that different QAIA variants (e.g., SimCIM, LQA) may require tuning different sets of hyperparameters. In traditional QAIA, these parameters are set to fixed values or determined empirically. This competition treats them as trainable hyperparameters, making them learnable through the Deep Unfolding framework, thereby achieving decoding performance superior to that of fixed parameters.
Why combine with DU? Traditional QAIA performs suboptimally for long code lengths, because its evolution equations are deterministic and it has very few tunable hyperparameters. This competition therefore encourages embedding QAIA's parameter-update strategy into the Deep Unfolding (DU) framework, making the hyperparameters trainable and thereby gaining more tunable degrees of freedom.
Scope Limitation Although other QAIA variants exist, this competition restricts QAIA to the following three specific algorithms and their variants (see Appendix I for details):
Simulated Bifurcation (SB) and its variants (e.g., discrete Simulated Bifurcation, dSB)
Simulated Coherent Ising Machine (SimCIM) and its variants
Local Quantum Annealing (LQA) and its variants
You are free to design the cost function for LDPC decoding yourself. Here is one idea for your reference (you may design your own). Following the idea presented in reference [2], We can transform the cost function of LDPC decoding into the following higher-order Ising model (for more details on traditional Ising model and higher-order Ising model, please see Appendix III):
1
M
∏
n
N
m
σ
I
m
,
n
)
(1)
L(σ)=
i=1
∑
N
−r
i
σ
i
+
2
λ
(M−
m=1
∑
M
n
∏
N
m
σ
I
m,n
(
1
−
σ
i
)
/
2
CodeBit
i
=(1−σ
i
)/2;
ri
:
r
i
:
r
i
r
i
is the Log-Likelihood Ratio (LLR) soft-decision information of the
i
i-th code bit, taken directly from the dataset (key soft_information). Sign convention:
r
i
0
r
i
0 favors bit 0 (
σ
i
=
2σ
0
2
1−2
x
^
i
2
1
10
(−SNR
dB
/10)
, where
x
^
i
x
^
i
is the normalized received symbol; the positive factor
1
/
(
2
σ
0
2
)
1/(2σ
0
2
) is absorbed by
ξ
i
(
t
)
ξ
i
(t) and hence dropped. Note that the LLRs provided in the dataset are obtained by demapping the received symbols (16-QAM in the sample code), so the expression above serves as a convention reference rather than the exact generation formula.
N:
N:
N
N is the number of code bits (i.e. code length), the code is the systematic code, and the first K bits are the information bits;
K:
K:
K
K is the number of information bits (i.e. information length);
K
/
N
R=K/N;
N
−
K
M=N−K;
H:
H:
H
H is parity check matrix with size
M
×
N
M×N;
Nm:
N
m
:
N
m
N
m
is the number of non-zero elements in
m
m-th row of the parity-check matrix;
Im,n:
I
m,n
:
I
m
,
n
I
m,n
is column index of the
n
n-th non-zero element in the
m
m-th row.
λ:
λ:
λ
λ is a tunable hyper parameter.
This format of cost function in Eq. (1) can combine with QAIA directly. Take discrete Simulated Bifurcation (dSB, reference [2]) as an example, the cost function and evolution equation are:
y
i
(
t
)
+
y
i
˙
(
t
)
Δ
t
if∣x
i
∣≤1:{
x
i
(t+Δt)=x
i
(t)+
x
i
˙
(t)Δt
y
i
(t+Δt)=y
i
(t)+
y
i
˙
(t)Δt
0
(2)
else:{
x
i
(t+Δt)=sign(x
i
(t))
y
i
(t+Δt)=0
(2)
where
sign
(
x
i
)
(3)
⎩
⎨
⎧
x
i
˙
(t)=y
i
(t)
y
i
˙
(t)=−(Δ−p(t))x
i
−ξ
∂x
i
∂L(x
i
)
x
i
=sign(x
i
)
1
Δ=1 , set as a constant;
t:
t:
t
t is the evolution time, which is discretized to
N
s
t
e
p
s
N
steps
according to the total evolution time
T
T;
Δt:
Δt:
Δ
t
Δt represents the step size for each evolution step;
t
/
T
p(t)=t/T is a coefficient that varies uniformly from 0 to 1 over time as the iteration moves forward;
ξ:
ξ:
ξ
ξ is a manually set hyperparameter, measures the relative scale between cost function term and bifurcation term;
sign
(
x
i
)
σ
i
=sign(x
i
);
yi:
y
i
:
y
i
y
i
represents the generalized momentum corresponding to generalized position
x
i
x
i
;
T
/
Δ
t
N
steps
=T/Δt.
However, traditional QAIA approach exhibits suboptimal performance in the parameter regime characterized by long code lengths, and the modification is necessary. The difficulty lies in the fact that evolution equation is deterministic and few hyperparameters can be tuned. The following presents a straight-forward way that combines dSB algorithm and DU. First, the cost function is reformulated as follows:
1
M
λ
m
(
t
)
2
[
1
−
∏
n
N
m
sign
(
x
I
m
,
n
)
]
(4)
L(x)=
i=1
∑
N
−r
i
sign(x
i
)+
m=1
∑
M
2
λ
m
(t)
[1−
n
∏
N
m
sign(x
I
m,n
)](4)
The evolution equation becomes:
y
i
(
t
)
+
y
i
˙
(
t
)
Δ
t
i
if∣x
i
∣≤1:{
x
i
(t+Δt
i
)=x
i
(t)+
x
i
˙
(t)Δt
i
y
i
(t+Δt
i
)=y
i
(t)+
y
i
˙
(t)Δt
i
sign
(
x
i
)
(6)
⎩
⎨
⎧
x
i
˙
(t)=y
i
(t)
y
i
˙
(t)=−(Δ−p
i
(t))x
i
+ξ
i
(t)
∂x
i
∂L(x
i
)
x
i
=sign(x
i
)
T
∑
t
Δt
i
=T;
pi(t):
p
i
(t):
p
i
(
t
)
p
i
(t) can change with evolution time
t
t and variable index
i
i, which has the size
N
steps
×
N
N
steps
×N. Note that it is not necessary to set
p
i
(
T
)
p
i
(T) as 1 for DU optimization,
p
i
(
T
)
p
i
(T) can be arbitrary positive value;
ξi(t):
ξ
i
(t):
ξ
i
(
t
)
ξ
i
(t) can change with evolution time
t
t and variable index
i
i, which has the size
N
steps
×
N
N
steps
×N;
λm(t):
λ
m
(t):
λ
m
(
t
)
λ
m
(t) can change with parity check bits' index
m
m and evolution time
t
t, which has the size
N
steps
×
M
N
steps
×M;
We define the cost function
C
[
Δ
t
i
,
p
i
(
t
)
,
ξ
i
(
t
)
,
λ
m
(
t
)
]
C[Δt
i
,p
i
(t),ξ
i
(t),λ
m
(t)] as follows:
1
A
lg
B
E
R
a
(7)
C[Δt
i
,p
i
(t),ξ
i
(t),λ
m
(t)]=
a=1
∑
A
lgBER
a
(7)
This form is given for demonstration only. To ease backpropagation and training, participants may adopt other loss functions or design the cost function freely.
Here,
B
E
R
a
BER
a
denotes the Bit Error Rate, i.e., the ratio of incorrectly received bits to the total number of information bits. The index
a
a ranges over the
A
A datasets, each characterized by a code length
N
N , a code rate
R
R, a parity check matrix
H
H , and a signal-to-noise ratio (SNR). By computing the gradient of
C
C with respect to
Δ
t
i
Δt
i
,
p
i
(
t
)
p
i
(t),
ξ
i
(
t
)
ξ
i
(t),
λ
m
(
t
)
λ
m
(t), we can optimize these hyperparameters to minimize
C
C and thereby improve decoding performance.
Beyond the examples above, participants may also:
modify the initial values
x
i
(
0
)
x
i
(0) and
y
i
(
0
)
y
i
(0);
reduce the number of hyperparameters for faster convergence or increase the number of hyperparameters for better decoding behavior;
introduce simple or empirical equations in the iteration or post-processing stage to improve performance;
design the cost function freely.
These options are suggestions, not requirements; participants are free to develop alternative strategies.
Decoding Model
input: the parity-check matrix
H
H (
(
N
−
K
)
×
N
(N−K)×N, with 0/1 entries) and the LLR soft information
r
i
r
i
for each bit.
Optional input: the generator matrix
G
G is also provided; contestants may also model the decoder based on
G
G.
Output: the recovered code bits (
N
N values, each 0 or 1).
Iteration constraint:
N
steps
≤
50
N
steps
≤50 . One iteration step is defined as updating
x
i
(
t
)
x
i
(t) and
y
i
(
t
)
y
i
(t) once each, if
y
i
(
t
)
y
i
(t) is not involved, one iteration step is defined as updating
x
i
(
t
)
x
i
(t) once.
Scoring
We need participants to combine QAIA and ideas of DU to develop an LDPC decoder that minimizes the difference between original bits and recovered bits. The score is calculated by following equation based on BER:
Number of incorrectly recovered information bits
Number of information bits
(9)
BER=
Number of information bits
Number of incorrectly recovered information bits
(9)
In Eq. (8),
a
a is the index of different dataset. The objective is to decrease BER within a fixed number of iteration layers (
N
steps
≤
50
N
steps
≤50). The final score is the sum from BERs under different data sets in Eq. (8). The higher the score, the better the LDPC decoding performance. The dataset used for evaluating algorithm performance is randomly generated under various SNRs. The challenge organizers will provide some public sample dataset, whereas the actual dataset used for scoring will not be publicly disclosed.
3
/
4
R=3/4.
Input
The first line contains four numbers
N
N,
K
K,
B
B, and
S
N
R
SNR, where
N
N,
K
K, and
B
B are integers representing the code bit length, the information bit length, and the batch size (default=500), respectively, and
S
N
R
SNR is a floating-point number representing the signal-to-noise ratio (in dB).
The next
N
−
K
N−K lines each contain
N
N integers (0 or 1), representing the parity-check matrix
H
H.
The next
B
B lines each contain
N
N floating-point numbers, representing the LLR soft information
r
i
r
i
for each bit.
The next
K
K lines each contain
N
N integers (0 or 1), representing the generator matrix
G
G.
Output
The output consists of
B
B lines, each containing
N
N integers (0 or 1), representing the decoded bits.
Sample
Sample Input 1
14 7 1 6.0
0 1 1 1 1 1 1 1 0 0 0 0 0 0
1 0 1 1 1 1 1 0 1 0 0 0 0 0
1 1 0 1 1 1 1 0 0 1 0 0 0 0
1 1 1 0 1 1 1 0 0 0 1 0 0 0
1 1 1 1 0 1 1 0 0 0 0 1 0 0
1 1 1 1 1 0 1 0 0 0 0 0 1 0
1 1 1 1 1 1 0 0 0 0 0 0 0 1
-1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
1 0 0 0 0 0 0 0 1 1 1 1 1 1
0 1 0 0 0 0 0 1 0 1 1 1 1 1
0 0 1 0 0 0 0 1 1 0 1 1 1 1
0 0 0 1 0 0 0 1 1 1 0 1 1 1
0 0 0 0 1 0 0 1 1 1 1 0 1 1
0 0 0 0 0 1 0 1 1 1 1 1 0 1
0 0 0 0 0 0 1 1 1 1 1 1 1 0
Sample Output 1
1 1 1 1 1 1 1 0 0 0 0 0 0 0
Large Sample Data Download publish.in publish.ans
Large Sample Data (20261125 updated) Download publish_20261125.zip
Requirements
Participants must use QAIA as the sole decoding framework, restricted to Simulated Bifurcation (SB, including its discrete variant dSB), Simulated Coherent Ising Machine (SimCIM), and Local Quantum Annealing (LQA), together with their variants. Submissions using any other algorithm as the primary decoder (e.g., belief propagation, min-sum, bit-flip) are invalid and scored zero. Post-processing the QAIA output with belief propagation, bit-flip, or their derivatives (e.g., MinSum, Normalized MinSum) is strictly prohibited.
The number of iteration steps in QAIA must satisfy
N
steps
≤
50
N
steps
≤ 50, one iteration step means updating
x
i
(
t
)
x
i
(t) and
y
i
(
t
)
y
i
(t) once, If participants adopt a method of batch-generating random initial guesses x_i (t) and y_i (t), and updating them for an LDPC code, a maximum of 6 sets of initial guesses shall be generated per LDPC code. If the update tasks submitted by participants cannot be executed in parallel, the total number of iterations will be calculated cumulatively. For instance, if a participant first performs 50 iterations using the bSB algorithm in Module A, and then performs another 50 iterations using the LQA algorithm in Module B with the output of Module A as the input, the total number of iterations will be 50 + 50 = 100.
The optimized parameter selection or the designed parameter update mechanism should be generalizable, ensuring that the proposed scheme is robust across randomly generated datasets. Note that different optimized parameters can be saved independently under different code length
N
N;
No information from ground-truth original bits can be used in the LDPC decoding algorithm;
The total size of all files submitted by the participant must be less than 512 KB;
The code submitted by participants must run within 2 minutes per case on the platform.
A public sample dataset provided by the organizers (see attachment).
Reference:
[1] https://doi.org/10.1103/PhysRevResearch.6.043325;
[2] https://ieeexplore.ieee.org/abstract/document/9366137;
[3] https://doi.org/10.1126/sciadv.abe7953.
Appendix I: Quantum Annealing Inspired Algorithms
Quantum annealing inspired algorithms (QAIA) are classical algorithms that simulate the behaviors of quantum mechanics or specialized physical hardware classically on conventional computers. By utilizing phenomena like quantum tunneling, bifurcation, and continuous spin evolution, these algorithms solve NP-hard combinatorial problems with massive speed and high parallelism. We shall briefly introduce QAIA related to this challenge, You may refer to the code implementation at https://atomgit.com/mindspore/mindquantum/tree/master/mindquantum/algorithm/qaia;
Simulated Bifurcation (SB): The Simulated Bifurcation algorithm is a fast, highly parallelizable combinatorial optimization method. It is inspired by the physical principles of non-linear resonant systems, specifically adiabatic bifurcation dynamics. SB converts discrete binary variables into continuous positions and momenta, embedding the optimization problem into classical Hamiltonian equations of motion. The algorithm starts with all particles in a stable, single-well potential. As time evolves, the system parameters change, forcing a 'bifurcation' where the single stable state splits into multiple distinct energy wells. The particles are naturally driven into these split states, which correspond to the local minima of the target problem. For more information on SB algorithm and its variants, you can see references: https://doi.org/10.1126/sciadv.abe7953, https://doi.org/10.1038/srep21686;
Simulated Coherent Ising Machine (SimCIM): SimCIM is a classical simulation algorithm that models the physical behavior of a Coherent Ising Machine (CIM). A physical CIM uses optical parametric oscillators (OPOs) in fiber loops where spins are represented by the phase amplitudes of light pulses. SimCIM captures this optical system using stochastic differential equations. It handles each spin as a continuous variable bounded within the range [-1,1]. During the iterative process, it simulates the interference, parametric amplification, linear loss, and noise inherent to the optical pulses. As the parametric gain increases over time, the continuous amplitudes are driven toward the boundaries, effectively settling the spins into a low-energy configuration. For more information on SimCIM algorithm and its variants, you can see references: https://doi.org/10.1364/OE.27.010288; https://doi.org/10.1002/qute.202100077.
Local Quantum Annealing (LQA): Local Quantum Annealing is quantum-inspired algorithm developed under the inspiration of Quantum Annealing. Its core idea is to utilize classical gradient-based optimization algorithms to simulate the process of quantum annealing. The term 'local' signifies that, unlike traditional quantum annealing, which globally updates a quantum state composed of multiple qubits via the Hamiltonian and the Schrödinger equation, the LQA method can rapidly update different quantum states individually based on gradients. For more information on LQA algorithm and its variants, you can see reference: https://doi.org/10.1103/PhysRevApplied.18.034016.
Appendix II: General Process of Wireless Communication
The following is the information flow in a typical wireless transmission process. We need participants to focus on step (6).
Source Coding: The process begins with raw data (such as text). The source encoder compresses the raw data to remove redundancy, outputting a clean, information-dense information bitstream (0-1 bits, which is randomly generated).
LDPC Encoding: The information bits from step (1) are passed to the LDPC encoder. By utilizing a parity-check matrix H, the encoder calculates and appends redundant parity check bits to the information bits. This creates a longer, error-resilient block of bits called a codeword.
Modulation: The binary codeword can't be transmitted directly into the air. A modulator maps groups of bits onto analog symbols (We use 16-QAM). These symbols are shifted to high frequencies and transmitted as electromagnetic waves;
Channel Transmission (Noise Addition): As the electromagnetic signal travels through the physical channel, the environment injects thermal noise (We use Additive White Gaussian Noise, AWGN) and causes attenuation, which distorts the clean analog waveforms.
Demodulation & LLR Generation: The receiver's demodulator captures the distorted analog waveform. Instead of making an immediate 'hard' guess on whether each bit is a 0 or a 1, it performs a 'soft' evaluation. It measures the voltage or phase distance of the received symbol from the ideal constellation points and calculates a Log-Likelihood Ratio (LLR) for each bit. These LLR values represent the 'soft information', where the sign indicates the most likely bit value and the magnitude indicates the confidence level.
LDPC Decoding (the module that participants need to develop): These LLR values in step (5) are fed into the LDPC decoder. The LDPC decoder will return recovered information bits.
Source Decoding: After obtaining the recovered bits, the parity bits are discarded, and the source decoder decompresses this error-free bitstream back into its original format for the user.
Appendix III: Traditional Ising model and Higher-Order Ising Model
The Ising model is originally developed to understand ferromagnetism in physics, it has evolved into a foundational mathematical tool in computer science and machine learning for solving complex combinatorial optimization problems. The traditional Ising model consists of discrete variables called spins, which can be in one of two states: up (+1) or down (-1). The model evaluates the total energy (i.e. cost function) of a system based on individual spin configurations
σ
i
∈
{
−
1
,
1
}
σ
i
∈{−1,1},external magnetic fields
h
i
h
i
,and pairwise interactions between spins
J
i
j
J
ij
. The mathematical expression for the traditional Ising model is (for simplicity, we omit negative signs and index constraints.):
(
1
−
σ
i
)
/
2
s
i
=(1−σ
i
)/2. While the traditional model is restricted to pairwise interactions, many complex real-world optimization landscapes involve simultaneous dependencies among multiple variables. The higher-order Ising Model expands the framework by incorporating multi-body interactions into the polynomial structure. The mathematical expression for the higher-order Ising model is
(
1
−
σ
i
)
/
2
s
i
=(1−σ
i
)/2.
I’ll benchmark your current SB approach against the uploaded samples, then test changes that preserve the 50-step, six-trajectory limit. I’ll keep public-sample results separate from any estimate of the hidden leaderboard score.
The updated archive contains 36 cases, and I found a useful difference from your tuning assumptions: the information-bit column weights vary from 2 to 8. Your current table has only one weight per rate. I’m also testing whether using the joint 16-QAM likelihood for parity-bit pairs improves the SB force, since your current force treats those parity bits independently.
The first parity-pair experiment did not beat the reconstructed baseline: it increased information-bit errors on the first 12 sample cases. I won’t carry that change into the recommended version. I’m now testing schedule and restart changes on independently generated AWGN frames, where the same six-trajectory rule can be maintained.
The synthetic tests show that the current high-rate schedules produce almost identical results from different initial noise amplitudes. That suggests the early layers erase much of the diversity you paid for with six trajectories. I’m testing a shared schedule that preserves this diversity, rather than adding a seventh guess or extra iterations.
So far, higher numerical precision and parity coupling have not produced a reliable gain. The stronger opportunity appears to be degree-aware tuning: a decoder trained for six checks per information bit behaves differently when the matrix has five or eight. I’ll use the synthetic sweep to select those adjustments and check them against all 36 public cases.
I’m testing one additional cost-function idea: redundant parity constraints formed algebraically from pairs of original checks. They would add a higher-order force to the existing SB update, without adding spins, message state, or post-processing. This is a new cost term, so it would need organizer review if it performs well.
The redundant-check regularizer also failed to improve the synthetic tests consistently, so I’m excluding it. I’m narrowing the final version to the already-reviewed force formula, a shared schedule for all six trajectories, and degree-dependent parameter calibration. That avoids introducing a new decoding mechanism just to chase the score.
The offline search found a useful improvement for weight-five, rate-1/2 codes, but the gains for other degree classes are smaller. The broader search did not finish within the execution budget. I’ll package the best supported shared-schedule candidate and measure it on the public data before claiming any score improvement.
The broad shared-schedule candidate lost score against the baseline on the 34 completed public cases. I won’t present it as an upgrade. The weight-five adjustment did improve several cases, so I’m testing a narrower patch that changes only that regime and retains your existing schedules elsewhere.
The narrower candidate now improves the public-sample score from 835.097 to 837.876 on the supplied scoring formula, with 170 fewer information-bit errors. That is a modest gain, not evidence of a 2.4M leaderboard score. I’ve produced both the higher-scoring candidate and a version with one shared schedule for all six trajectories.
I tested several improvements to your SB decoder using the updated 36-case dataset and independently generated AWGN training data.
The best verified candidate improves your baseline, but I have not achieved or verified 2.4M.
Higher-scoring candidate · 18.3 KB
[Download]
Identical evolution parameters for all six trajectories
[Download]
Current leaderboard score
Target score
Requires +6.42%
Measured results on the 36 updated public cases, using Equation (8) directly:
| Metric | P8 baseline | P9 candidate |
|---|---|---|
| Information-bit errors | 34,058 | 33,888 |
| Public sample score | 835.097 | 837.876 |
| Iterations | 50 | 50 |
| Initial guesses | 6 | 6 |
| BP / MinSum | No | No |
| Bit-flip post-processing | No | No |
The candidate also completed the original 500-codeword sample in 7.88 seconds locally, with zero parity violations.
Your existing hyperparameters were trained primarily for information-bit column weights 6, 3 and 2. However, the updated dataset includes additional graph structures.
| Code rate | Existing tuning weight | Updated dataset weights |
|---|---|---|
| 1/2 | 6 | 5, 6, 7, 8 |
| 2/3 | 3 | 2, 3, 4 |
| 3/4 | 2 | 2 |
This makes degree-aware and SNR-aware hyperparameter training a promising direction for further improvement.
The score candidate uses calibrated parameters for weight-five, rate-1/2 codes. Other regimes retain your original schedules.
| Modification | Result |
|---|---|
| Degree-aware hyperparameters | Improved selected cases |
| Joint parity-symbol likelihood | Rejected |
| Redundant parity-check forces | Rejected |
| Higher-precision tanh and log odds | No consistent improvement |
| Time-dependent beta and alpha | No consistent improvement |
| Momentum and restoring-force tuning | Mixed results |
| Confidence-dependent spin scaling | Mixed results |
| Shared trajectory parameters | Small aggregate score reduction |
bashg++ -O3 -std=c++17 sol_p9_score_candidate.cpp -o solution ./solution < publish.in > result.out
Important compliance consideration: the higher-scoring version retains your original A/B schedule distinction outside the calibrated regime. Use it only if the organizers confirm that distinction is allowed. The shared-schedule version removes that particular ambiguity.
The public data was used for final calibration and validation, so the measured improvement is not an independent hidden-test result. The broader offline parameter search was also incomplete.
I would not claim that either file achieves 2.4M. Reaching that target requires a considerably larger improvement than the one verified here, most likely through joint training of all six trajectories across code lengths, rates, column weights and SNR ranges.