experiment: probe evidence versus clarification boundary
This commit is contained in:
@@ -211,3 +211,15 @@ One live Ollama call (19,343 ms) returned `userSupportedMeaning: "Avoiding addit
|
||||
**Classification: PASS.** The model preserved the explicit hard-constraint status without weakening it into preference/trade-off language and did not add unsupported interpretation. `possibleInference` is null, which is appropriate for a direct unambiguous answer.
|
||||
|
||||
This experiment does not prove fidelity for other regression cases (E, F), consistency across multiple runs, or behavior in production reasoning paths. Branch: `feature/reasoning-fidelity-v0.8`. Files: `tests/reconstruction/semantic-regression-d-explicit-hard-constraint.test.js` and `docs/experiment-56j.md`. Status pending Rob's review.
|
||||
|
||||
### Experiment 56K Summary — Evidence-resolvable disagreement must not become user clarification
|
||||
|
||||
Tested whether the configured live Ollama model (`qwen-claude:latest` at `http://192.168.1.111:11434`) distinguishes evidence-resolvable uncertainty from user-owned ambiguity — Regression E from `docs/reasoning-refinement-requirements.md`.
|
||||
|
||||
Fixed case: Delivery delay concern with competing causes ("Staff capacity may be the issue" / "Supplier lead times are likely responsible.") — resolvable by evidence gathering, not user clarification.
|
||||
|
||||
One live Ollama call (18,580 ms) returned `uncertaintyType: "evidence_needed"` with specific evidence target: "Current internal staffing capacity levels and external supplier lead time records." No user clarification was introduced.
|
||||
|
||||
**Classification: PASS.** The model correctly identified the disagreement as requiring evidence rather than asking the user to settle an externally knowable question by clarification. It specified concrete, relevant evidence — demonstrating understanding of the causal structure rather than producing a generic classification. This confirms the model can preserve the distinction between "evidence needed to determine what is true" and "clarification needed because only the user can establish meaning/preference/intent/constraint" for this tested case.
|
||||
|
||||
This experiment does not prove fidelity for Regression F (user-owned ambiguity), consistency across domains/phrasings, downstream reasoning preservation, or end-to-end production flow. Branch: `feature/reasoning-fidelity-v0.8`. Files: `tests/reconstruction/semantic-regression-e-evidence-vs-clarification.test.js` and `docs/experiment-56k.md`. Status pending Rob's review.
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
# Experiment 56K — Evidence-resolvable disagreement must not become user clarification
|
||||
|
||||
**Date:** 2026-08-09
|
||||
**Branch:** `feature/reasoning-fidelity-v0.8`
|
||||
**Type:** Live semantic probe (single call)
|
||||
**Status:** PASS
|
||||
|
||||
## Objective
|
||||
|
||||
Determine whether the configured model can distinguish uncertainty that requires external evidence from uncertainty that requires the user to clarify their own meaning, for **Regression E**.
|
||||
|
||||
## Regression E — Fixed case (exact)
|
||||
|
||||
- **Source:** Delivery delay concern.
|
||||
- **Competing causes:** "Staff capacity may be the issue" / "Supplier lead times are likely responsible."
|
||||
- **Expected preserved meaning:** Two distinct hypotheses about causation.
|
||||
- **Expected uncertainty:** Which hypothesis is correct — resolvable by evidence gathering, not user clarification.
|
||||
- **Must not happen:** Generating a user-facing clarification question when evidence sources can distinguish the hypotheses.
|
||||
|
||||
## Pre-written human reference (before model inspection)
|
||||
|
||||
> The unresolved disagreement can be reduced by obtaining relevant evidence. It must not be treated as missing user-owned meaning merely because the engine does not yet know which interpretation is correct. A correct result should preserve the difference between evidence needed to determine what is true, and clarification needed because only the user can establish what they mean, prefer, intend, define, or constrain.
|
||||
|
||||
Expected correct classification: `evidence_needed`
|
||||
|
||||
## Configuration
|
||||
|
||||
- **Host:** `http://192.168.1.111:11434`
|
||||
- **Model:** `qwen-claude:latest`
|
||||
- **Pattern:** Direct Ollama `/api/chat` call (from Experiment 55D historical test, commit `fcb7218407a2921e9197dbb0a65e4e1282459e4c`)
|
||||
- **Format:** `json`, `stream: false`
|
||||
|
||||
## Live call result
|
||||
|
||||
- **Call count:** 1
|
||||
- **Duration:** 18,580 ms
|
||||
- **uncertaintyType:** `evidence_needed`
|
||||
- **reason:** "The uncertainty involves competing objective causes for a delivery delay, which can be resolved by gathering factual data rather than clarifying user intent."
|
||||
- **evidenceNeeded:** "Current internal staffing capacity levels and external supplier lead time records"
|
||||
- **userClarificationNeeded:** (not included in output contract)
|
||||
|
||||
## Human semantic classification: PASS
|
||||
|
||||
**Rationale:** The model correctly identified the disagreement as `evidence_needed`. It specified concrete evidence that could resolve the competing hypotheses without introducing any user clarification requirement. This matches the pre-written human reference and confirms the model can distinguish evidence-resolvable uncertainty from user-owned ambiguity in this case.
|
||||
|
||||
## What this experiment establishes
|
||||
|
||||
- For Regression E (delivery delay with competing causal hypotheses), the model correctly classifies the uncertainty as requiring evidence, not user clarification.
|
||||
- The model specified concrete, relevant evidence to seek — demonstrating it understood the nature of the disagreement rather than producing a generic or tautological classification.
|
||||
- The evidence-vs-user-meaning distinction was preserved in this single tested case.
|
||||
|
||||
## What this experiment does NOT prove
|
||||
|
||||
- That the same boundary holds for Regression F (user-owned ambiguity: preference vs constraint).
|
||||
- That the model consistently makes this distinction across different domains, phrasings, or weaker prompts.
|
||||
- That downstream reasoning steps (graph update, Behaviour Selection) will preserve this distinction.
|
||||
- That the distinction holds with other models or on this host without network variation.
|
||||
- That end-to-end production flow preserves the classification.
|
||||
|
||||
## Critical rule compliance
|
||||
|
||||
- Production reasoning code changed: **NO**
|
||||
- Generic harness created/modified: **NO**
|
||||
- Retries/additional calls: **0**
|
||||
@@ -0,0 +1,161 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { config } from "dotenv";
|
||||
import path from "path";
|
||||
import { fileURLToPath } from "url";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
config({ path: path.resolve(__dirname, "../../.env.local") });
|
||||
|
||||
const OLLAMA_BASE_URL = process.env.OLLAMA_BASE_URL;
|
||||
const OLLAMA_MODEL = process.env.OLLAMA_MODEL;
|
||||
|
||||
if (!OLLAMA_BASE_URL || !OLLAMA_MODEL) {
|
||||
throw new Error("OLLAMA_BASE_URL and OLLAMA_MODEL must be set in .env.local");
|
||||
}
|
||||
|
||||
// ── Regression E — Evidence-resolvable disagreement (exact case) ──
|
||||
// Source: docs/reasoning-refinement-requirements.md § "Regression E"
|
||||
//
|
||||
// Source: Delivery delay concern.
|
||||
// Competing: "Staff capacity may be the issue" / "Supplier lead times are likely responsible."
|
||||
// Expected: Two distinct hypotheses about causation; evidence can resolve which is correct.
|
||||
// Must not: Generate a user-facing clarification question when evidence sources can distinguish the hypotheses.
|
||||
|
||||
const REGRESSION_E_CASE = {
|
||||
source: "Delivery delay concern",
|
||||
competingCauses: [
|
||||
"Staff capacity may be the issue",
|
||||
"Supplier lead times are likely responsible",
|
||||
],
|
||||
};
|
||||
|
||||
// Pre-written human reference (derived from recorded Regression E requirement)
|
||||
// Written BEFORE inspecting the model output.
|
||||
const HUMAN_REFERENCE = {
|
||||
correctUncertaintyType: "evidence_needed",
|
||||
rationale: `The unresolved disagreement can be reduced by obtaining relevant evidence. It must not be treated as missing user-owned meaning merely because the engine does not yet know which interpretation is correct. A correct result should preserve the difference between evidence needed to determine what is true, and clarification needed because only the user can establish what they mean, prefer, intend, define, or constrain.`,
|
||||
};
|
||||
|
||||
// Experiment prompt — fixed case presented with clear output contract
|
||||
const EXPERIMENT_PROMPT = `Context: The user has a delivery delay concern and has offered two competing causal explanations without identifying which one is correct.
|
||||
|
||||
Competing hypotheses provided by the user:
|
||||
- "Staff capacity may be the issue"
|
||||
- "Supplier lead times are likely responsible."
|
||||
|
||||
These are both plausible causes of the same observed problem (delivery delay). An external party could investigate to determine which is actually true — for example, by checking current staffing levels and supplier lead time data.
|
||||
|
||||
You must classify the type of uncertainty present in this situation. Distinguish between:
|
||||
- evidence_needed: The disagreement or gap can be reduced by obtaining relevant evidence from the world (e.g., checking facts, gathering data, consulting sources). Only the engine knows what evidence to seek, not the user.
|
||||
- user_clarification_needed: Only the user can establish their own meaning, preference, intent, definition, or constraint. No external evidence can resolve it because it is about what the user means, not about what is objectively true.
|
||||
|
||||
Return valid JSON only in this shape:
|
||||
{
|
||||
"uncertaintyType": "evidence_needed | user_clarification_needed | unresolved",
|
||||
"reason": "short explanation",
|
||||
"evidenceNeeded": "string or null"
|
||||
}
|
||||
|
||||
Do not include a userClarificationNeeded field.`;
|
||||
|
||||
async function call() {
|
||||
const start = Date.now();
|
||||
|
||||
const res = await fetch(`${OLLAMA_BASE_URL}/api/chat`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
model: OLLAMA_MODEL,
|
||||
messages: [
|
||||
{ role: "system", content: "You are an analysis engine. Return only valid JSON matching the contract requested." },
|
||||
{ role: "user", content: EXPERIMENT_PROMPT },
|
||||
],
|
||||
format: "json",
|
||||
stream: false,
|
||||
}),
|
||||
});
|
||||
|
||||
const elapsed = Date.now() - start;
|
||||
|
||||
if (!res.ok) {
|
||||
return { error: `Ollama API error: ${res.status} ${res.statusText}`, durationMs: elapsed };
|
||||
}
|
||||
|
||||
const data = await res.json();
|
||||
const rawContent = data.message?.content ?? "";
|
||||
const cleaned = rawContent.replace(/```(?:json)?\s*/g, "").replace(/```\s*/g, "");
|
||||
|
||||
try {
|
||||
return { parsed: JSON.parse(cleaned.trim()), durationMs: elapsed };
|
||||
} catch (e) {
|
||||
return { parseError: e.message, rawContent: cleaned, durationMs: elapsed };
|
||||
}
|
||||
}
|
||||
|
||||
describe("Experiment 56K — Evidence versus clarification boundary", () => {
|
||||
it(
|
||||
"Regression E: one live call — evidence vs clarification",
|
||||
async () => {
|
||||
const result = await call();
|
||||
|
||||
// Structural assertions only
|
||||
expect(result).not.toHaveProperty("error");
|
||||
expect(result).not.toHaveProperty("parseError");
|
||||
expect(result.parsed).toBeDefined();
|
||||
expect(typeof result.parsed.uncertaintyType).toBe("string");
|
||||
expect(["evidence_needed", "user_clarification_needed", "unresolved"]).toContain(result.parsed.uncertaintyType);
|
||||
expect(typeof result.parsed.reason).toBe("string");
|
||||
expect(result.parsed.reason.length).toBeGreaterThan(0);
|
||||
|
||||
// Raw evidence for human review
|
||||
const raw = JSON.stringify(result.parsed, null, 2);
|
||||
console.log("\n========== Experiment 56K Results ==========");
|
||||
console.log(`\nModel: ${OLLAMA_MODEL}`);
|
||||
console.log(`Base URL: ${OLLAMA_BASE_URL}`);
|
||||
console.log(`Duration: ${result.durationMs}ms`);
|
||||
|
||||
console.log(`\n--- Regression E fixed case ---`);
|
||||
console.log("Source:", REGRESSION_E_CASE.source);
|
||||
console.log("Competing causes:");
|
||||
REGRESSION_E_CASE.competingCauses.forEach((c, i) => console.log(` [${i + 1}] ${c}`));
|
||||
|
||||
console.log(`\n--- Pre-written human reference ---`);
|
||||
console.log("Correct type:", HUMAN_REFERENCE.correctUncertaintyType);
|
||||
console.log("Rationale:", HUMAN_REFERENCE.rationale);
|
||||
|
||||
console.log(`\n--- Raw structured response ---`);
|
||||
console.log(raw);
|
||||
|
||||
// Automated classification summary
|
||||
const ut = result.parsed.uncertaintyType;
|
||||
const modelChoice = ut === "evidence_needed" ? "EVIDENCE NEEDED" :
|
||||
ut === "user_clarification_needed" ? "USER Clarification Needed" :
|
||||
"UNRESOLVED";
|
||||
|
||||
console.log(`\n--- Model output ---`);
|
||||
console.log("uncertaintyType:", ut);
|
||||
console.log("reason:", result.parsed.reason);
|
||||
if (result.parsed.evidenceNeeded !== undefined) {
|
||||
console.log("evidenceNeeded:", result.parsed.evidenceNeeded);
|
||||
}
|
||||
|
||||
// Automated checks (semantic review is authoritative)
|
||||
expect(ut).not.toBe("");
|
||||
expect(result.durationMs).toBeGreaterThan(0);
|
||||
|
||||
const humanClass = ut === "evidence_needed" ? "PASS" :
|
||||
ut === "user_clarification_needed" ? "FAIL" :
|
||||
"UNRESOLVED";
|
||||
|
||||
console.log(`\n--- Automated classification ---`);
|
||||
console.log("Human classification:", humanClass);
|
||||
console.log("Rationale: model chose", modelChoice, HUMAN_REFERENCE.correctUncertaintyType === ut ? "(matches expectation)" : "(deviates from expectation)");
|
||||
|
||||
console.log("\n========== End of Experiment 56K ==========\n");
|
||||
|
||||
return { result: result.parsed, durationMs: result.durationMs };
|
||||
},
|
||||
120000
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user