Confidence is Data: Make Scores Travel with Values, Not Status Bars
TLDR
Rendering confidence scores exclusively in UI status bars discards trustworthiness data before downstream execution steps can evaluate it. Wrapping extracted values in a unified metadata container ({ value, score, stage }) allows downstream validation stages to handle uncertain inputs appropriately.
| Confidence Model | Storage Location | Downstream Accessibility | Auditability |
|---|---|---|---|
| UI-Only Badge Display | Temporary UI Component | Lost after extraction stage | Poor (Re-derivation required) |
| Traveling Value Tag | Value Wrapper Container | 100% Retained Across Stages | Full Stage Lineage History |
UI-only confidence badges discard evaluation metrics before validation stages execute
Data pipelines often calculate confidence metrics during initial extraction steps (e.g., OCR table extraction or LLM field parsing). Standard implementations render this score in a UI badge and pass a bare text string to subsequent processing stages.
Discarding confidence scores forces downstream validation stages to treat low-confidence guesses and verified facts identically, leading to unhandled errors.
Encapsulating extractions in a traveling metadata object guarantees downstream threshold safety
We restructured pipeline value handoffs to encapsulate the raw data alongside score and provenance attributes:
BAD PRACTICE (Value Only):
[LLM Extractor] ──> "Alice" ──────────> [Validation Stage] (Is it correct? Who knows!)
│
└─► (Renders 0.75 UI badge... then throws score away)
GOOD PRACTICE (Traveling Tag Wrapper): [LLM Extractor] │ ▼ { value: "Alice", score: 0.75, stage: 'candidate' } │ ▼ [Validation Stage] ──> Reads score: 0.75 ──> Rejects! (Threshold: 0.90 required)
Here is the implementation of the encapsulated tag wrapper:
// Standardized metadata tag encapsulating value, confidence, and stage lineage
export function createTaggedValue(value, initialScore, toolName) {
return {
value,
score: initialScore, // e.g., 0.75 for unverified extraction
source: toolName,
stage: 'candidate',
timestamp: Date.now()
};
}
// Downstream validation updates confidence explicitly export function validateTaggedValue(taggedItem, validationFn) { const isValid = validationFn(taggedItem.value); return { ...taggedItem, score: isValid ? 1.0 : 0.0, stage: isValid ? 'validated' : 'rejected', timestamp: Date.now() }; }
Downstream execution stages read the score property directly, refusing to process values below configured threshold limits.
Rule of thumb: Encapsulate values with confidence scores and stage lineage to let downstream stages evaluate data trustworthiness.