Inspiration Prediction markets show probabilities for individual questions, but related markets can imply logical constraints that are difficult to monitor manually. For example, an event occurring before an earlier deadline should never be more probable than the same event occurring before a later deadline. Two mutually exclusive outcomes should not have probabilities that sum to more than 100%. Finding these relationships requires more than comparing titles. An analyst must read the full descriptions, resolution sources, dates, and event context. SignalForge was created to automate this reasoning without trusting an AI model to perform the final mathematics. AI understands the relationship. Mathematics verifies the probability.
What it does SignalForge is an AI-powered logical consistency engine for prediction markets. A user selects a live public Polymarket event and two markets. SignalForge then:
- fetches and normalizes public market data;
- sends the full resolution evidence to Gemini;
- classifies the semantic relationship between the markets;
- validates the structured model response with Zod;
- applies a deterministic probability constraint in TypeScript;
- returns PASS, WARNING, or ABSTAIN;
- explains the result using the already-computed verdict. The result displays the relationship type, confidence, reasoning, expected mathematical constraint, observed probabilities, consistency gap, and final verdict. The LLM never decides whether the probability constraint passes or fails. AI interprets semantics; deterministic code owns the verdict.
How we built it SignalForge is a Next.js App Router application written in TypeScript. The end-to-end pipeline is: Polymarket Public API → Market/Event Adapter → Defensive Normalizer → Gemini Semantic Classifier → Structured JSON → Zod Validation → Deterministic Probability Engine → PASS/WARNING/ABSTAIN → Grounded Explanation → Dashboard A dedicated Polymarket adapter prevents the interface from depending directly on external Gamma API response shapes. All Gemini requests run in server-side route handlers, so the API key is never exposed to the browser. The semantic classifier receives both market questions, descriptions, resolution sources, start and end dates, and surrounding event context. It returns a strict object containing: ・relationship type; ・ logical direction; ・ same-resolution-scope decision; ・ confidence score; ・abstention flag; ・supporting reason. The deterministic engine is implemented separately as pure TypeScript functions. It checks constraints including: ・prerequisite or subset: (P(A) \le P(B)) ・mutually exclusive: (P(A) + P(B) \le 1) ・equivalent: (|P(A) - P(B)| \le \text{tolerance}) ・exhaustive binary pair: (|P(A) + P(B) - 1| \le \text{tolerance}) A second Gemini request may generate concise explanatory prose, but it receives the locked deterministic result and cannot change the verdict. If that explanation request fails, SignalForge preserves the result and displays deterministic fallback text.
Challenges we ran into Defensively normalizing real Polymarket data Real public API responses cannot be treated as perfectly typed application data. Polymarket fields such as outcomes and outcomePrices may arrive as stringified JSON. Numeric values may be strings, optional dates or metadata may be missing, and malformed outcome arrays may not align with their probability arrays. SignalForge therefore never sends raw Polymarket objects directly to the interface or probability engine. The adapter: ・validates outer event and market structures; ・safely parses normal arrays and stringified JSON arrays; ・accepts only finite numeric values; ・rejects probabilities outside the range 0–1; ・checks that outcomes and probabilities have matching lengths; ・validates date values; ・drops unusable markets instead of crashing the application; ・exposes one normalized internal market type. This boundary contains external schema inconsistencies before they can become interface failures or misleading calculations. Containing nondeterministic LLM output Semantic interpretation is where an LLM is useful, but unrestricted model output is unsafe for a logical verification system. A model can produce malformed JSON, select an unsupported relationship, overstate confidence, or infer a relationship from similar titles even when the resolution dates and conditions differ. SignalForge contains this nondeterminism at several layers: ・the prompt includes full resolution evidence rather than titles alone; ・output is restricted to a small relationship enum; ・the response must follow a strict structured schema; ・Zod rejects malformed or incomplete output; ・a configurable confidence threshold forces uncertain cases to abstain; ・resolution-scope checks prevent unsafe comparisons; ・invalid output never reaches the mathematical engine; ・the deterministic TypeScript engine performs every pass/fail calculation. The optional explanation model receives an already-locked result. It can explain the verdict but cannot alter it. This produces a clear trust boundary: AI interprets language, while deterministic code verifies probability. Keeping a live demo reliable A hackathon demonstration should use live data, but it should not fail completely because an upstream service times out. SignalForge includes three curated real-market scenarios. Each scenario attempts a fresh Polymarket request first. If the upstream service is unavailable, the application uses an explicitly labelled, source-controlled snapshot. Snapshot data is never presented as live. If Gemini fails, the fetched market data remains visible and the user receives a clear, retryable error instead of a crashed application or fabricated result. Accomplishments that we’re proud of ・A complete one-screen workflow using real public prediction-market data. ・A meaningful AI integration with a narrow and auditable responsibility. ・A deterministic probability engine supporting PASS, WARNING, and ABSTAIN. ・Defensive API normalization and strict runtime validation. ・Three curated scenarios with transparent snapshot fallback. ・Graceful handling of authentication, rate-limit, server, timeout, malformed-output, and explanation failures. ・Automated tests, CI, architecture documentation, citations, and reproducible setup instructions. ・Independent public deployments for hosting redundancy. ・A complete solo project delivered during the hackathon period. What we learned The most reliable AI architecture does not ask the model to own every decision. SignalForge became stronger when semantic interpretation and mathematical verification were separated. The LLM handles ambiguous natural language, deterministic code enforces mathematical invariants, and ABSTAIN is treated as a valid safety outcome rather than a failure. We also learned that production reliability depends on boundaries: normalizing external data, validating model output, preserving results when optional services fail, and explicitly communicating degraded states. What’s next for SignalForge Potential extensions include: ・batch consistency analysis across an entire event; ・a small relationship graph for several markets; ・price-history views showing when a warning emerged; ・counterfactual consistency bounds showing the nearest logically consistent probability. SignalForge will remain an analytical research tool. It is not a betting application, trading bot, wallet, order-execution client, arbitrage executor, or source of financial advice. Hackathon disclosure Core development was completed during Impact Forge Summer 2026. SignalForge was built as a solo hackathon project using documented open-source libraries and public APIs.
Built With
- geminiapi
- githubactions
- googleaistudio
- next.js
- node.js
- openainodesdk
- polymarketapi
- react
- tailwindcss
- typescript
- vercel
- vitest
- zod
Log in or sign up for Devpost to join the conversation.