DEV Community

FatherSon
FatherSon

Posted on

Combinatorial Arbitrage on Polymarket: Using LLMs to Find Hidden Linked Market Edges

Most prediction market bots only hunt the obvious: YES + NO prices on the same market drifting apart. That edge is crowded and shrinking.

The real alpha lives in combinatorial arbitrage — pairs of separate markets that are logically dependent even though the platform lists them independently.

Example:

  • Market X: "Will Team A win?"
  • Market Y: "Will Team A win by 2+ goals?"

If Y resolves YES, X must resolve YES. Prices across the two markets must obey this constraint. When they don't, you can construct a risk-free (or low-risk) position that profits from the mispricing.

The hard part? There are thousands of live Polymarket markets. Brute-forcing every pair explodes to an intractable search space. That's why almost nobody runs it — until now.

The Practical LLM Pipeline for Combinatorial Arb

Here's a production-ready funnel that shrinks the problem dramatically before any expensive LLM calls:

1. Aggressive Pre-Filtering (Cheap & Critical)

  • Same resolution date: Markets about the same event almost always close on the same day. Different dates → almost never linked. Drop them.
  • Same topic cluster: Use text embeddings (e.g., Linq-Embed-Mistral or similar) + cosine similarity to group markets into politics, sports, crypto, etc. Cross-topic pairs are almost always independent.

These two filters alone turn "impossible" into "tractable."

2. Reduce Each Market to 5 Conditions

Large multi-outcome markets kill LLM reliability. Solution:

  • Keep the top 4 outcomes by trading volume (they usually hold >90% of liquidity).
  • Collapse the long tail into one catch-all 5th condition ("any other outcome").

Prompts stay short, hallucinations drop, and the logical completeness is preserved.

3. Let the LLM Discover Dependencies

Feed the LLM the reduced conditions from two markets and ask it to enumerate all valid true/false combinations.

Prompt core idea:

"Given these binary conditions from Market A and Market B, list every logically possible combination where exactly one outcome per market is true. Return strict JSON."

Strong reasoning models (DeepSeek-R1-Distill-Qwen-32B or equivalents) excel here.

Key signal: If the number of valid combinations returned is less than (conditions_A × conditions_B), the markets have logical dependencies worth exploiting.

4. Strict Validation Layer (Kill False Positives)

Never trust the model raw. Run these checks:

  • Valid JSON output
  • Exactly one True per market in every combination
  • Total combinations ≤ n + m (for reduced markets)
  • No reasoning loops or exhaustive dumps

In real runs, this step reduces thousands of LLM flags down to a few hundred candidates. Manual review then finds the genuine linked pairs.

5. Price Gap Detection on Survivors

For confirmed dependent pairs:

  • Identify the logically linked outcome subsets.
  • Compare the summed YES prices across the linked legs.
  • When the sums diverge, the gap is the edge.

Construct the arb by buying the cheap side and the complementary positions on the expensive side. Profit ≈ size of the mispricing (minus slippage and non-atomic fill risk).

Why This Works Technically

Simple single-market arb is a local price check. Combinatorial arb requires global logical consistency across independent order books. The LLM acts as a cheap, high-quality logical reasoner that humans can't scale and naive scripts can't handle.

By filtering first, reducing context, and validating outputs, you turn an O(2^(n+m)) nightmare into a practical daily pipeline.

The original research that inspired this approach is available here: https://arxiv.org/pdf/2508.03474

Implementation Notes for Builders

  • Run the filters in Python/pandas before any API calls.
  • Cache topic embeddings and resolution dates.
  • Use structured output / JSON mode on the LLM.
  • Monitor for model drift — re-validate periodically.
  • Size positions conservatively because legs are non-atomic.

Combinatorial edges are still wide open precisely because the search was previously considered impossible. With smart filtering + modern reasoning models, that barrier is gone.

I run this pipeline live and share fresh pairs regularly.

If you have more questions, please feel free to contact me at any time: https://t.me/FatherSon97

Polymarket #CombinatorialArbitrage #PredictionMarkets #LLM #AIAgents #DeFi #CryptoArbitrage #Solana #PredictionMarketArb #MachineLearning #CryptoTrading #Web3

Top comments (0)