Skip to content

Commit 45fb7b8

Browse files
committed
docs: plan direct and optimal DeltaWire specification research
1 parent cbf0255 commit 45fb7b8

1 file changed

Lines changed: 130 additions & 0 deletions

File tree

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
# DeltaWire research plan: direct and optimal specification
2+
3+
## Purpose
4+
5+
Determine how an agent can describe a dataset relationship without authoring executable generation code, while preserving exactness and using fewer model tokens than both the current DeltaWire JSON plan and an unrestricted coding-agent baseline.
6+
7+
ZCA separates two research slices:
8+
9+
1. **Direct specification:** the agent states the required dataset relationship; a system-owned compiler produces and verifies the artifact.
10+
2. **Optimal specification:** the system selects the least expensive admissible representation or backend for that relationship.
11+
12+
This is a product-interface investigation, not a larger benchmark or research-infrastructure program.
13+
14+
## Evidence baseline
15+
16+
The six-trial isolated `range-large` comparison established:
17+
18+
- All six final artifacts were exact: 500 ordered records with only integer `index` values 1–500.
19+
- Both trials that genuinely completed the DeltaWire lifecycle were exact: 2/2.
20+
- DeltaWire treatment fidelity was 2/3; one D1 agent ignored the assigned plan and generated the artifact directly.
21+
- The valid JSON plan was 673 bytes and deterministically rendered 6,892 bytes, a 10.24x byte expansion.
22+
- The two valid D1/B0 comparisons used 1.543x and 1.073x the baseline input-plus-output tokens. Their median ratio was 1.308x, or 30.8% overhead.
23+
- Valid D1 required 10–12 tool calls; isolated B0 required 3–5.
24+
- B0 authored executable generation logic: two Bash loops and one Node.js loop. It did not use Python or DeltaWire.
25+
26+
Accuracy is therefore proven only for this simple range: 6/6 final outputs and 2/2 genuine DeltaWire outputs. Earlier evidence showed that a structurally valid `matrix-large` plan could still be semantically wrong, so accuracy is not yet established across families.
27+
28+
The current bottleneck is not deterministic expansion. It is the agent-facing acquisition path: skill activation, reference discovery, repeated reads, ownership rules, and editing an implementation-oriented JSON plan.
29+
30+
## Stage 1: direct specification
31+
32+
### Research question
33+
34+
Can the agent express the desired record relationship directly, without loops or backend-specific generator instructions, in fewer interactions than both current JSON-plan authoring and arbitrary code generation?
35+
36+
### Proposed boundary
37+
38+
The agent supplies a declarative dataset contract containing only:
39+
40+
- output format and path;
41+
- record schema and key;
42+
- finite domains or explicit examples;
43+
- relations such as ranges, products, variants, and exceptions;
44+
- derived fields and piecewise rules;
45+
- count, uniqueness, coverage, and ordering requirements.
46+
47+
The agent must not supply Bash, Python, JavaScript, Go, SQL, or another executable program. A system-owned translator normalizes the contract, proves computable cardinality where possible, produces the existing DeltaWire plan, and invokes the existing validator, renderer, checker, and semantic oracle.
48+
49+
Start with four falsifiable examples:
50+
51+
1. A range with piecewise derived values.
52+
2. A Cartesian authorization matrix with conditional expected outcomes.
53+
3. A base record with missing, null, empty, malformed, and boundary variants.
54+
4. An irregular dataset that must be rejected or explicitly abstained from.
55+
56+
Do not add multiple backends in this stage. Compile only to the current DeltaWire plan so the experiment isolates the agent-facing specification.
57+
58+
### Experiment
59+
60+
For each regular example, compare three arms under the same model and semantic oracle:
61+
62+
- unrestricted agent-authored code;
63+
- current DeltaWire JSON plan;
64+
- direct declarative specification.
65+
66+
Measure semantic exactness, treatment completion, input/output/cache tokens, tool calls, repair turns, wall time, specification bytes, generated-plan bytes, and artifact bytes. Keep null metrics null and report every failed outcome.
67+
68+
### Stage-1 acceptance
69+
70+
- Every accepted direct specification has statically computable cardinality and deterministic ordering.
71+
- Canonical and mutation fixtures prove exact semantics, not only schema validity.
72+
- No agent-authored executable code reaches the generation boundary.
73+
- Treatment completion is 3/3 on each high-fit family before cross-family claims.
74+
- Direct specification uses fewer tool calls and fewer median input-plus-output tokens than current JSON-plan authoring.
75+
- Token savings versus unrestricted code are reported only where both arms are exact.
76+
77+
## Stage 2: optimal specification
78+
79+
### Research question
80+
81+
Given a validated dataset relationship, which admissible representation minimizes total generation cost without weakening determinism, safety, or verification?
82+
83+
Define optimization subject to correctness:
84+
85+
```text
86+
minimize agent tokens + repair turns + execution cost
87+
subject to exact semantic verification,
88+
deterministic output,
89+
no agent-authored executable code,
90+
bounded expansion,
91+
retained provenance
92+
```
93+
94+
The system may evaluate equivalent internal realizations such as a native DeltaWire plan, a system-generated streaming program, or literal materialization. These are compiler outputs, not agent inputs. If Python is added later, it is generated and owned by the compiler; current DeltaWire does not accept Python scripts.
95+
96+
### Selection model
97+
98+
For each candidate representation, compute or estimate:
99+
100+
- exact cardinality;
101+
- specification and generated-artifact bytes;
102+
- projected memory and streaming behavior;
103+
- backend capability coverage;
104+
- verification completeness;
105+
- expected agent interaction cost;
106+
- deterministic reproducibility.
107+
108+
Reject ambiguous or unbounded models. Prefer the lowest-cost candidate that preserves the complete verification contract. Abstain when literal data or a repository-native fixture is simpler than a generated model.
109+
110+
### Experiment
111+
112+
Use scale points of 500, 10,000, and 100,000 records plus increasing relational complexity. Compare direct specification, the selected optimal representation, current JSON plans, and unrestricted code. Separate simple ranges from matrices, derived piecewise data, and variants so output size is not confused with reasoning complexity.
113+
114+
### Stage-2 acceptance
115+
116+
- Backend selection is deterministic for identical normalized input.
117+
- Every selected backend passes the same independent semantic oracle.
118+
- Selection never chooses executable generation when a safer representation has equal or lower measured cost.
119+
- High-fit workloads demonstrate lower median model tokens than current JSON plans and unrestricted code.
120+
- Low-fit workloads produce an explicit, correct abstention instead of forced DeltaWire use.
121+
122+
## Deliverables and decision gates
123+
124+
1. Freeze the six-trial JSON-plan evidence as the baseline.
125+
2. Publish a compact direct-specification grammar with the four examples and rejected ambiguity cases.
126+
3. Build one translator to the existing DeltaWire plan and validate it without changing rendering semantics.
127+
4. Run the three-arm direct-specification experiment and decide whether token overhead is removed.
128+
5. Only after Stage 1 succeeds, design and test optimal backend selection.
129+
130+
The next implementation phase is Stage 1 only. It must not introduce arbitrary script input, multi-backend selection, a broad benchmark campaign, or claims beyond observed accuracy and token measurements.

0 commit comments

Comments
 (0)