← All work

POC exploration

Neutrality Is a Build Constraint, Not a Prompt

14 prompt iterations · 44% latency reduction · deterministic missing detection

AI WorkflowsPlatform Performance / Reliability

TradeOff is an election-literacy experiment built around fictional candidates. The obvious version would put two manifestos into a prompt and ask Gemini for a balanced comparison. I did not trust that version. Candidate identity, document order, writing quality, and the model's prior knowledge can all become hidden inputs while the answer still sounds neutral.

So neutrality moved out of the prompt and into the pipeline. Identity-bearing details are removed before analysis. Both manifestos pass through the same extract, classify, and score stages. Extracted claims carry source spans that can be checked against the original text. Most importantly, missing-issue detection is a set difference in code. The model can identify the issue attached to a claim, but it does not get to improvise which side omitted a topic once the structured sets exist.

Fictional candidates were a deliberate constraint. Using real politicians would make the demo more topical, but it would also let prior model knowledge leak around the documents being compared. A single giant prompt was tempting because it would shorten the build. It would also make symmetry hard to inspect. In this system, equivalent inputs are expected to follow equivalent paths, and swapping them is something the checks can exercise rather than something a disclaimer asks people to believe.

The build took fourteen prompt iterations. That number matters only because the iterations are visible engineering work, not because fourteen is inherently impressive. A separate infrastructure decision cut latency by 44% after compute moved closer to the Vertex AI region. It was a useful reminder that an AI product can feel like it has a model problem when it actually has a geography problem.

This still does not make the product perfectly neutral. The issue taxonomy and scoring rubric carry judgment, and those need versioning, review, and a correction path. Source provenance also has to remain visible in the interface. A clean pipeline can still produce an unfair comparison if the categories underneath it are poorly chosen.

The point is narrower: "be unbiased" is not an architecture. A comparison becomes more trustworthy when identity is controlled, both sides take the same path, source claims are inspectable, and the parts that can be exact are removed from generative output.

The decision

Treat neutrality as a property of the whole pipeline: remove identity before analysis, keep equivalent inputs on symmetric paths, and compute missing issues with deterministic set difference after structured extraction.

Alternatives considered

  • ·Use real candidates and ask for an unbiased comparison. More topical, but identity and prior model knowledge become hidden inputs.
  • ·Put both documents into one large prompt. Quick to build, but prompt position and prose style can influence the comparison.
  • ·Ask the model which issues are missing. Natural language is flexible, but the same evidence can produce different omissions across runs.

Tech stack

Gemini 2.5 FlashVertex AICloud RunFirestoreNext.js

The challenge

Compare two fictional election manifestos in a way that teaches issue-level trade-offs without letting candidate identity, prompt order, or a fluent model decide which side looks more complete.

Architecture approach

  • ·Used fictional candidates and stripped identity-bearing fields before the comparison step.
  • ·Extracted, classified, and scored manifesto claims through the same structured stages for both sides.
  • ·Verified cited spans against source text and moved missing-issue detection into a pure set operation.
  • ·Added symmetry checks so swapping equivalent inputs does not silently change how the pipeline treats them.

Results

  • Fourteen prompt iterations captured as engineering evidence rather than hidden tuning
  • A 44% latency reduction after moving compute closer to the Vertex AI region
  • A live comparison whose missing-issue output is owned by code, not generated prose

What I'd do differently at production scale

  • ·A neutral pipeline can still inherit bias from the issue taxonomy and scoring rubric; both need versioning and external review.
  • ·Source provenance should be visible beside every extracted claim, with a correction path when span validation is not enough.
  • ·The product is an education tool, not voting advice, and the interface needs to keep that boundary clear.