Skip to content

Commit c2aa839

Browse files
committed
Add PhiSpiral256 SoA cross-system integration plan
1 parent f427efe commit c2aa839

1 file changed

Lines changed: 231 additions & 0 deletions

File tree

Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
1+
# PhiSpiral256 SoA Cross-System Integration Plan — lance-graph
2+
3+
## Goal
4+
5+
Define how PhiSpiral256 integrates with lance-graph as a separate SoA lane for orthogonal local residual location.
6+
7+
PhiSpiral256 must sit beside existing lanes without mixing meanings:
8+
9+
```text
10+
CAM_PQ
11+
meaning / semantic basin lane
12+
13+
PolarQuant
14+
magnitude / similarity lane
15+
16+
PhiSpiral256
17+
orthogonal local residual location lane
18+
19+
BGZ17
20+
golden offset/stride recoverable sampling skeleton
21+
22+
Fisher-z cosine
23+
optional scorer/gate after candidate ranking
24+
```
25+
26+
## Cross-system role
27+
28+
`ndarray` owns:
29+
30+
```text
31+
PhiSpiral256 center generation
32+
distance / neighbor tables
33+
atom16 pack/unpack
34+
local encode/decode kernels
35+
Fisher-z gate if used numerically
36+
```
37+
38+
`lance-graph` owns:
39+
40+
```text
41+
SoA schema placement
42+
leaf packet graph relationships
43+
HHTL / CAM_PQ / PolarQuant / PhiSpiral lane composition
44+
candidate routing tables
45+
provenance and certificates
46+
integration fixtures
47+
```
48+
49+
## Schema concept
50+
51+
Use a leaf-location sidecar table first. Do not force PhiSpiral256 into unrelated graph structures.
52+
53+
```text
54+
leaf_planetarium_atoms
55+
leaf_id: UInt64
56+
atom_index: UInt8
57+
atom16: UInt16
58+
confidence_q: UInt8
59+
cam_pq_id: UInt16?
60+
polarquant_id: UInt8?
61+
replay_ref: UInt64?
62+
certificate_id: Utf8?
63+
```
64+
65+
Optional expanded debug view:
66+
67+
```text
68+
leaf_planetarium_atoms_debug
69+
leaf_id
70+
phi_spiral_id
71+
mag4
72+
bgz_offset_family
73+
bgz_stride_family
74+
confidence_q
75+
cam_pq_id
76+
polarquant_id
77+
plane
78+
```
79+
80+
## Graph model
81+
82+
```text
83+
Leaf
84+
-> HAS_PLANETARIUM_ATOM -> PhiSpiralAtom
85+
-> HAS_MEANING_CODE -> CamPqCode
86+
-> HAS_MAGNITUDE_CODE -> PolarQuantCode
87+
-> HAS_RECOVERY_SCHEDULE -> BgzRecoverySchedule
88+
-> HAS_CERTIFICATE -> Certificate
89+
```
90+
91+
Keep atom nodes optional. For performance, atoms should primarily live in SoA tables.
92+
93+
## Route key
94+
95+
Callers may compose a route/candidate key:
96+
97+
```rust
98+
pub struct LeafPlanetariumRouteKey {
99+
pub cam_pq_id: u16,
100+
pub phi_spiral_id: u8,
101+
pub mag4: u8,
102+
pub bgz_offset_family: u8,
103+
pub bgz_stride_family: u8,
104+
pub plane: u8,
105+
}
106+
```
107+
108+
This key is for routing or candidate lookup only. It does not redefine CAM_PQ, PolarQuant, BGZ17, or Fisher-z.
109+
110+
## Candidate table
111+
112+
```text
113+
leaf_planetarium_candidates
114+
route_key_hash: UInt64
115+
candidate_basin_id: UInt64
116+
priority_q: UInt16
117+
evidence_count: UInt32
118+
last_calibrated_epoch: UInt64
119+
```
120+
121+
This enables:
122+
123+
```text
124+
route key -> candidate basin set
125+
```
126+
127+
without forcing exact replay.
128+
129+
## Calibration baselines
130+
131+
The integration must compare against:
132+
133+
```text
134+
Mag4 only
135+
BGZ17 L1 / weighted L1
136+
BGZ17 sign agreement
137+
PolarQuant only
138+
PhiSpiral256 Euclidean
139+
PhiSpiral256 Poincare/Mobius
140+
PhiSpiral256 + Fisher-z gate
141+
Hybrid: CAM_PQ + PolarQuant + PhiSpiral256 + BGZ17 schedule
142+
```
143+
144+
## Integration metrics
145+
146+
```text
147+
candidate fanout reduction
148+
leaf replay reduction
149+
route-key collision rate
150+
wrong-basin high-confidence rate
151+
SoA scan throughput
152+
atom table byte size
153+
candidate table byte size
154+
query latency impact
155+
calibration stability across datasets
156+
```
157+
158+
## Fixtures
159+
160+
Start with synthetic fixtures:
161+
162+
```text
163+
single meaning axis
164+
orthogonal residual directions
165+
controlled missing locations
166+
known candidate basins
167+
known noisy / ambiguous cases
168+
```
169+
170+
Then add real-ish fixtures:
171+
172+
```text
173+
CAM_PQ meaning codes
174+
BGZ17 residual fingerprints
175+
PolarQuant magnitude bands
176+
multi-atom leaf packets
177+
```
178+
179+
## Query examples
180+
181+
```sql
182+
SELECT leaf_id, atom16, confidence_q
183+
FROM leaf_planetarium_atoms
184+
WHERE confidence_q >= 200;
185+
```
186+
187+
```sql
188+
SELECT candidate_basin_id
189+
FROM leaf_planetarium_candidates
190+
WHERE route_key_hash = ?
191+
ORDER BY priority_q DESC
192+
LIMIT 8;
193+
```
194+
195+
## Distortion and safety gates
196+
197+
Reject or widen candidates when:
198+
199+
```text
200+
spiral bin occupancy is too skewed
201+
route-key collision rate is too high
202+
Fisher-z margin is too small, if gate is enabled
203+
wrong-high-confidence rate rises above threshold
204+
multi-atom packets exceed configured K too often
205+
```
206+
207+
## Implementation phases
208+
209+
```text
210+
Phase 0: plan docs and term separation
211+
Phase 1: ndarray PhiSpiral256 kernel + tests
212+
Phase 2: Lance/Arrow SoA table shape
213+
Phase 3: synthetic fixture and calibration report
214+
Phase 4: integrate with CAM_PQ / PolarQuant / BGZ17 lanes
215+
Phase 5: candidate table and route-key lookup
216+
Phase 6: real dataset replay reduction benchmark
217+
```
218+
219+
## Acceptance criteria
220+
221+
- PhiSpiral256 appears as its own lane in SoA schemas.
222+
- CAM_PQ, PolarQuant, BGZ17, Palette256, Fisher-z terminology remains separated.
223+
- Synthetic fixture proves better orthogonal location recall than Mag4-only.
224+
- Hybrid route key reduces candidate fanout or exact replay in at least one fixture.
225+
- Candidate table lookups are deterministic and explainable.
226+
227+
## Wall sentence
228+
229+
```text
230+
CAM_PQ says what it means, PolarQuant says how much, PhiSpiral256 says where the unexplained part lives, and BGZ17 remembers how to recover it.
231+
```

0 commit comments

Comments
 (0)