Skip to content

SPDSolver: continuous correlated solver for p-bit / Ising models. - #138

Merged
toncho11 merged 5 commits into
IBM:mainfrom
toncho11:spd_solver
Sep 21, 2026
Merged

toncho11 merged 5 commits into
IBM:mainfrom
toncho11:spd_solver

Conversation

@toncho11

Copy link
Copy Markdown
Collaborator

SPDSolver: continuous correlated solver for p-bit / Ising models.

This is the first continous solver in p-kit.

The solver maps the discrete Ising parameters (J, h) to a symmetric positive-definite (SPD) representation before sampling. The SPD structure provides a valid continuous correlated state space, allowing proposals to be generated collectively rather than by updating p-bits independently.

A continuous solver may provide better results, but the problem must first be mapped successfully to a continuous space. This is the first and main obstacle. Therefore, the J,h -> SPD mapping is validated before use. If the mapping quality is below the configured threshold, SPDSolver can fall back to another solver. Use fall_back_solver= in this case.

  • mode="fast" uses a fixed SPD geometry for efficient continuous correlated proposals
  • mode="analog" evolves the SPD state dynamically with Riemannian operations to better reflect a future analog hardware implementation.

SPDSolver is particularly useful for correlated sampling, optimization, and future analog implementations where continuous SPD dynamics may be implemented directly into hardware.

For problems requiring very accurate sampling of the target Boltzmann distribution, especially as problem size grows, GibbsSolver may still provide better distribution fidelity.

And tests.

The solver maps the discrete Ising parameters (J, h) to a symmetric
positive-definite (SPD) representation before sampling. The SPD structure
provides a valid continuous correlated state space, allowing proposals to
be generated collectively rather than by updating p-bits independently.

And tests.

@gcattan gcattan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I trust you on the math.
A couple of things regarding the architectural contract.

Comment thread p_kit/solver/spd_solver.py Outdated
return eigenvectors @ (np.sqrt(eigenvalues) * z)


class SPDSolver:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should inherite from Solver and keep Backend/Solver separation.

Comment thread p_kit/solver/spd_solver.py Outdated
raise TypeError(f"{name}.solve(circuit) must return an (I, m) tuple")
return out[0], out[1]

def solve(self, circuit):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

annealing function is not supported.

Comment thread p_kit/solver/spd_solver.py Outdated
self.energies_ = all_E
self.acceptance_rate_ = accepted / self.Nt
self.final_distance_ = riem_dist(X, target)
return all_I, all_m

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only when return_filtered. If not, then the return should be I, m, E

@toncho11
toncho11 merged commit 4b828a1 into IBM:main Sep 21, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants