SShortSingh.
Back to feed

How a required schema field forced an AI pipeline to fabricate statistics every time

0
·1 views

A developer discovered that an automated article-generation pipeline had been publishing invented statistics across multiple languages, not through a deliberate audit but while reviewing an unrelated part of the codebase. The root cause was a required output schema field that demanded a statistic and source for every article, combined with prompt instructions telling the model to estimate a plausible figure when it lacked a real one and to omit the publication year to keep content looking evergreen. A separate chart-generation block compounded the problem by independently hallucinating data while being instructed to cite official sources like the Bureau of Labor Statistics. The developer noted that adding honesty disclaimers to the prompt would not fix the issue, since a language model cannot distinguish a fabricated number from a recalled one. The fix was structural: making the statistic field optional, skipping it entirely when no verified source URL existed, and replacing unsupported figures with qualitative language instead.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Developer builds single API call that chains background removal, lifestyle shots, and SEO copy

A developer has built a tool called Product Studio that chains three AI models behind a single API call to automate product photography workflows for e-commerce sellers on platforms like Etsy and Amazon. The pipeline runs a segmentation model for background removal, an optional compositing model for lifestyle scene generation, and an optional GPT-4o-mini call for SEO listing copy. Each stage is handled by a purpose-built model rather than a single generalist, improving reliability and output consistency. To reduce prompt variability on a paid one-shot service, lifestyle scene options are limited to four presets instead of open-ended user input. The system is designed with graceful failure handling, so if one stage fails the user still receives output from completed stages, and a payment-grant mechanism ensures unpaid add-ons cannot trigger more expensive model calls.

0
ProgrammingDEV Community ·

Negative prompts, not AI models, are key to realistic AI dating profile photos

A developer building an AI dating photo tool found that preventing the telltale 'waxy skin' look was harder than preserving facial identity across generated images. The workflow uses two sequential fal.ai API calls — one for identity-preserving photo generation and a second upscaling pass focused solely on restoring realistic skin texture. Negative prompts targeting terms like 'plastic skin,' 'poreless skin,' and 'beauty filter' were found to do more practical work against the synthetic appearance problem than model selection alone. To avoid serverless timeout limits on Cloudflare Pages Functions, the system generates one photo style per request rather than batching all styles together. Payment is handled via HMAC-signed grants verified through the Web Crypto API, ensuring no AI generation call is made unless a valid, unexpired payment token is present.

0
ProgrammingDEV Community ·

Developer launches NexaTools: 50+ free browser-based tools with no uploads or accounts

A developer has built NexaTools, a suite of over 50 browser-based utilities covering image conversion, PDF editing, file transfer, and developer tools, all accessible at nexatools.in. Most tools run entirely client-side, meaning user files are never sent to an external server, addressing privacy concerns around popular online converters. Media processing is powered by FFmpeg compiled to WebAssembly, which loads into the browser and handles audio and video conversion locally without file size restrictions. Peer-to-peer file transfers use WebRTC, with a lightweight signaling server only facilitating device discovery while actual data moves directly between browsers. The platform functions as a Progressive Web App, allowing offline use after the first load, and requires no sign-up or account creation.

0
ProgrammingDEV Community ·

Structured LLM Output Ensures Valid Syntax, Not Accurate or Trustworthy Data

Constrained decoding and JSON schema enforcement guarantee that AI model outputs are syntactically valid, but offer no assurance that the values are factually correct or semantically meaningful. Teams have increasingly conflated schema-valid output with correct output, creating a new class of production bugs where well-formed data contains wrong or hallucinated values. Unlike the malformed JSON errors of early LLM integrations, these failures produce no exceptions or logs, making them far harder to detect. The problem mirrors a lesson web developers learned with client-side form validation: passing a shape check does not mean the underlying data can be trusted. Developers are urged to treat structured LLM output like input from any untrusted API client, with schema validation as a starting point rather than a final safeguard.

How a required schema field forced an AI pipeline to fabricate statistics every time · ShortSingh