Explainer

XQuad in practice: two demos, one toolchain

Quip Network
Postquant Labs
·5 min read

Two of our demos now run on XQuad, the toolchain behind the Quip Virtual Machine. One is a trading game that close to a hundred people played at Quantum.Tech World in June. The other is a logistics yard where a D-Wave chip and a classical annealer compete to plan the day's trucks.

They use XQuad differently, and that is the point of this post. The trading game shows the solver layer and the network order on a QUBO it already had. Parcel Forum shows the constraint language, with the problem written in XQuad from the ground up.

What is XQuad?

XQuad is a toolchain for quadratic optimization problems: the QUBO and Ising models that quantum annealers and classical samplers both solve. You write a problem once as a short program in XQuad's constraint language (xqcp), the XQVM compiles it to a quadratic model and verifies that the model says what the program said, and the solver layer (xqsa) sends that same model to a D-Wave QPU, a local simulated annealer, a GPU, or the Quip Network. The install is one line: pip install "xquad[quip]".

The practical difference from writing a QUBO problem by hand is that constraints become instructions. "A package cannot ride two trucks" is one call, not a loop that writes out penalty terms. Parcel Forum was built by hand and then ported to that language, which made it a clean test: a port that changed the problem would have shown up in the numbers. The trading game keeps its hand-built QUBO and plugs XQuad in underneath.

Demo 1: the Quantum World trading game

The trading game was first demoed at Quantum.Tech World in Boston, where close to a hundred booth visitors each built a trading agent in about two minutes. A booth screen showed the live leaderboard and the share of races won by quantum versus classical solvers.

How it works: starting with a watchlist, players pick at least 15 names out of a basket of 28 assets (14 crypto, 14 quantum and tech stocks), and set four sliders for rebalance frequency, risk preference, maximum position size, and number of assets to hold.

The backend turns that into a mean-variance portfolio problem, with expected returns and covariance from real hourly market data, encodes it as a QUBO, and hands it to several solvers at once in a "solver race". The fastest feasible answer becomes the agent's portfolio. A QR code opens the player's phone profile with live P&L and the option to retune, and every retune is a new optimization job.

What XQuad adds in the next version of the game: an XQuad solver joins the race alongside simulated annealing and Gurobi, and it can be pointed at a D-Wave QPU, a local annealer, or the Quip Network. In Quip mode, each manual solve is also posted to the Quip testnet as an order. Orders take over a minute to finalize, so they run in a background queue rather than racing, and the result (status, objective, order ID) is recorded with the job. The network order never changes the player's portfolio; it is a receipt that the same problem ran on the network.

The port is done and smoke-tested against the testnet; it will ship with the next network upgrade, and we will follow up with the live numbers once it does.

Demo 2: the Parcel Forum yard

The second demo is a dispatch problem: there is more freight in the yard than the fleet can carry, every package is worth something different, and the question is which packages to take and how they share trucks so a revenue target is reached at the lowest cost. The cost has three parts: a truck's day rate, road cost, and re-handling (the time spent moving freight that is in the way).

The yard problem is now stated as XQuad constraints: EXCLUDE for "one truck or none" per package, SLACK and EQUALITY for capacity that only applies if the truck rolls, ATLEASTW for the revenue floor, and ADDLINE and ADDQUAD for the three cost terms.

The search improves a plan eight packages at a time, and each eight-package "bag" is its own small xqcp program, built on the XQVM and sent to the chip by xqsa. Each run uses eighty bags, with 512 reads of 120 microseconds each on a D-Wave Advantage2.

What was measured

The port was checked three ways, and all three are on the demo pages.

The matrix is the same. The yard model XQuad built was compared coefficient by coefficient with the hand-built one on all seven settings of the problem. There were zero mismatches.

The answers are the same. A 24-variable bag solved through XQuad matches brute force. The bag loop run with XQuad's annealer and with the demo's original gave identical plans on 11 of 12 runs, with the twelfth within annealer noise.

The chip answers the same. On Advantage2, across 80 bags, three seeds and three settings, the chip's cost through XQuad was at or below the simulated annealer's on all nine runs, and profit against the best classical alternative (tabu search) was 0.1 to 2.1% ahead at the hardest re-handling setting. That is the same band the September runs produced through D-Wave's own library, which is what a correct port should show.

At the realistic re-handling rate, the chip matched simulated annealing (identical on four of nine runs, within 3% on the rest) and traded wins with tabu. The structure the chip exploits only becomes decisive at the stress setting.

What is claimed, and what is not

Claimed: both demos run on XQuad, the models reproduce the hand-built ones exactly, and the chip runs labelled "via XQuad" went through that path on real hardware.

Not claimed: that XQuad made the chip better. It is the same chip, the same embedding, the same reads. A port is measured by whether anything changed, and nothing did.

Not claimed: a general quantum advantage. On the yard problem the chip matches classical solvers at typical loads and pulls ahead by a small margin only on the hardest instances. Finding a construction where the chip wins on time to a given quality is the open research item, and the port is what that work now runs on.

Two things learned

XQuad's result type returns the single best read. The bag loop wants every read, because it takes the first feasible one that improves the plan, so the demo wraps the sampler and keeps the full set. And XQuad's models are integer, so every dollar figure is scaled to cents before it goes in, and pricing is done outside the model.

Try it

The Parcel Forum demo is live at parcelforum-demo.netlify.app, with an explainer of how XQuad is used and a hardware page that runs the packing problem on the chip. The hardware page's live run will go through XQuad on the next deployment of the solver service; until then, the verification pages show the XQuad runs side by side with the originals. The XQuad documentation and a worked first job are at developers.quip.network/docs/xquad.

Share
Filed underExplainer
Newsletter

Don't miss an update

Get new posts and project updates delivered to your inbox. No spam, unsubscribe anytime.