AbstractPhil commited on
Commit
cb0556e
Β·
verified Β·
1 Parent(s): b7bd1b2

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +186 -112
README.md CHANGED
@@ -6,7 +6,6 @@ tags:
6
  - geometric-deep-learning
7
  - cross-modal
8
  - multi-modal
9
- - retrieval
10
  - pentachoron
11
  - procrustes
12
  - bert
@@ -14,41 +13,116 @@ tags:
14
  - whisper
15
  - esm2
16
  - codebert
17
- - contrastive-learning
 
18
  language:
19
  - en
20
  library_name: pytorch
21
  pipeline_tag: feature-extraction
22
  ---
23
 
24
- # GEOLIP-Bertenstein - AKA the GEOLIP-Conduit prototype
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
- **A multi-expert geometric fusion transformer that bridges 4 independently-trained encoders into a shared embedding space using BERT-large as a universal text hub.**
27
-
28
- One layer. One epoch. Perfect cross-modal retrieval. Universal pentachoron geometry.
29
-
30
- The entire design is meant to create an alignment bridge with multiple different modalities, multiple different dimensional sizes, and multiple different independent structures into a format
31
- that can be consumed downstream by another system for useful association.
32
-
33
- This system uses a form of procrustes whitening analysis that aligns multiple systems of information through a shared structural boundary,
34
- with well defined and understood complexity association differentiations.
35
-
36
- This is not meant to be a MOE, this is meant to be a collective understanding and cooperation of alignments through direct and indirect association.
37
-
38
- ## Results
39
 
40
- | Expert Pair | R@1 | Cosine | Pentachoron CV |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  |---|---|---|---|
42
- | text ↔ audio (1.5K val) | **1.0000** | 0.972 | **0.203** |
43
- | text ↔ code (5K val) | **0.9996** | 0.988 | **0.195** |
44
- | text ↔ image (5K val) | **1.0000** | 0.986 | **0.196** |
45
- | text ↔ protein (2.3K val) | **0.9987** | 0.979 | **0.200** |
46
- | text ↔ image (40K test) | **1.0000** | 0.980 | **0.208** |
47
-
48
- All CV values converge to the **0.20 Β± 0.01 universal band** β€” the same geometric constant measured across 17 neural architectures before this model existed.
49
-
50
- The current results only used a partial protein and partial audio dataset for preliminary, which left the sample size smaller and less conclusively potential
51
- as a full dataset run can yield due to the increased data capacity for alignment.
 
 
 
 
 
 
 
 
 
52
 
53
  ## Architecture
54
 
@@ -71,111 +145,111 @@ as a full dataset run can yield due to the increased data capacity for alignment
71
  β””β”€β”€β”€β”€β”€β”€β”˜
72
  ```
73
 
74
- **Frozen encoders** (not trained, not included in this repo):
75
- - **BERT-large** (336M) β€” universal text hub
76
- - **DINOv2-large** (302M) β€” natural images
77
- - **Whisper-large-v3** encoder (1.5B) β€” speech audio
78
- - **ESM-2-650M** (652M) β€” protein sequences
79
- - **CodeBERT-base** (125M) β€” source code
80
-
81
- **Trainable fusion** (this repo): **41.5M params**
82
- - 1 shared transformer layer (8.9M)
83
- - 5 expert modules (text + 4 modalities, ~7M each)
84
- - Includes Procrustes pre-alignment buffers per expert
85
-
86
- ## How It Works
87
-
88
- 1. **Procrustes Pre-Alignment**: Before training, compute optimal orthogonal rotation to align each expert's coordinate system with BERT's text space. Whitened Procrustes with centering.
89
-
90
- 2. **Expert Modules**: Each modality gets a projection layer, learned cross-attention pooling (257 image patches β†’ 16 tokens, 1500 audio frames β†’ 16 tokens, etc.), a special `<|MODALITY|>` token, and an output head.
91
-
92
- 3. **Fusion Sequence**: `[<|TEXT|>] [text_tokens] [<|IMAGE|>] [img_tokens] ...` β€” bidirectional self-attention across all modalities. Text tokens attend to image patches. Audio tokens attend to text tokens.
93
-
94
- 4. **Geometric Loss**: InfoNCE contrastive + pentachoron CV variance (Cayley-Menger) + Procrustes SVD alignment. The geometric components drive the embedding manifold toward the universal 0.20 CV band.
95
-
96
- 5. **Text Hub**: All modalities pair with text during training. Cross-modal alignment (e.g., audio↔image) emerges transitively through the shared text space.
97
-
98
- ## Procrustes Pre-Alignment
99
-
100
- | Expert | cos before | cos after | Dimension |
101
- |---|---|---|---|
102
- | audio | 0.0004 | **0.4404** | 1280 β†’ 1024 (PCA down) |
103
- | code | -0.0016 | **0.4036** | 768 β†’ 1024 (zero-pad up) |
104
- | image | 0.0038 | **0.4107** | 1024 β†’ 1024 (direct) |
105
- | protein | 0.0005 | **0.3771** | 1280 β†’ 1024 (PCA down) |
106
 
107
  ## Training
108
 
109
- - **Data**: COCO-Caption (40K), LibriSpeech clean-100 (10K), CodeSearchNet Python (50K), Protein2Text-QA (15K)
110
- - **Schedule**: 3 epochs, round-robin across experts, cosine LR 3e-4 β†’ 1e-6
111
- - **Hardware**: NVIDIA RTX PRO 6000 Blackwell (102 GB VRAM)
112
- - **Time**: ~11 minutes total (3 Γ— ~220s)
113
-
114
- ## Key Finding: Universal Pentachoron Geometry
115
-
116
- The coefficient of variation (CV) of pentachoron (4-simplex) volumes, measured via Cayley-Menger determinants, converges to **0.20 Β± 0.01** across:
117
-
118
- - 17 pretrained models (T5, BERT, CLIP, DINOv2, SD UNets, VAEs)
119
- - 5 architecture families (transformer, UNet, convolutional autoencoder)
120
- - 4 modalities in this fusion model (audio, code, image, protein)
121
-
122
- This constant emerges in ANY embedding space that reaches convergence through gradient-based contrastive learning, regardless of modality, architecture, or training objective.
123
-
124
- ## File Structure
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
 
126
  ```
127
  geolip-bertenstein/
128
  β”œβ”€β”€ checkpoints/
129
- β”‚ β”œβ”€β”€ epoch_001/
130
- β”‚ β”‚ β”œβ”€β”€ model.safetensors
131
- β”‚ β”‚ β”œβ”€β”€ loss.safetensors
132
- β”‚ β”‚ β”œβ”€β”€ training_state.pt
133
- β”‚ β”‚ └── config.json
134
- β”‚ β”œβ”€β”€ epoch_002/
135
- β”‚ β”œβ”€β”€ epoch_003/
136
- β”‚ └── final/
137
- β”‚ β”œβ”€β”€ model.safetensors
138
- β”‚ β”œβ”€β”€ loss.safetensors
139
- β”‚ β”œβ”€β”€ training_state.pt
140
- β”‚ β”œβ”€β”€ config.json
141
- β”‚ β”œβ”€β”€ aligner_audio.safetensors
142
- β”‚ β”œβ”€β”€ aligner_code.safetensors
143
- β”‚ β”œβ”€β”€ aligner_image.safetensors
144
- β”‚ └── aligner_protein.safetensors
145
  β”œβ”€β”€ tensorboard/
146
- β”œβ”€β”€ bertenstein_results.json
147
- β”œβ”€β”€ stage2_bertenstein.py
 
148
  └── README.md
149
  ```
150
 
151
- ## Usage
152
-
153
- ```python
154
- from safetensors.torch import load_file
155
- import torch
156
-
157
- # Load model weights
158
- state = load_file("checkpoints/final/model.safetensors")
159
-
160
- # Reconstruct model (see stage2_bertenstein.py for full class definitions)
161
- from stage2_bertenstein import BertensteinFusion, ExpertModule, ProcrustesAligner, FusionConfig
162
-
163
- # ... build model, load state_dict, run inference
164
- ```
165
-
166
- Precomputed embedding caches (Arrow format) for all modalities: [`AbstractPhil/geolip-bertenstein-cache`](https://huggingface.co/datasets/AbstractPhil/geolip-bertenstein-cache)
167
 
168
- ## Geometric Terrain Analysis
169
 
170
- The foundational profiling of 17 models and Procrustes alignment analysis: [`AbstractPhil/procrustes-analysis`](https://huggingface.co/AbstractPhil/procrustes-analysis)
 
 
171
 
172
  ## Citation
173
 
174
  ```bibtex
175
  @misc{abstractphil2026bertenstein,
176
- title={GEOLIP-Bertenstein: Cross-Modal Alignment Through Shared Pentachoron Geometry},
177
  author={AbstractPhil},
178
  year={2026},
 
179
  url={https://huggingface.co/AbstractPhil/geolip-bertenstein}
180
  }
181
  ```
 
6
  - geometric-deep-learning
7
  - cross-modal
8
  - multi-modal
 
9
  - pentachoron
10
  - procrustes
11
  - bert
 
13
  - whisper
14
  - esm2
15
  - codebert
16
+ - archived
17
+ - research-precursor
18
  language:
19
  - en
20
  library_name: pytorch
21
  pipeline_tag: feature-extraction
22
  ---
23
 
24
+ # GEOLIP-Bertenstein β€” multimodal Procrustes alignment prototype
25
+
26
+ **An early test of a single question: can whitened Procrustes alignment build a usable
27
+ shared space across independently-trained encoders of different modalities and different
28
+ dimensionalities?**
29
+
30
+ Four frozen experts β€” DINOv2-large, Whisper-large-v3, ESM-2-650M, CodeBERT-base β€” each
31
+ pre-aligned into BERT-large's text space by a whitened Procrustes map, then fused by a
32
+ single bidirectional transformer layer. 41.5M trainable parameters over ~11 minutes.
33
+
34
+ > ### Status: archived precursor β€” superseded, retained for lineage
35
+ >
36
+ > This is one of the **preliminary Procrustes-whitening exercises** that opened the
37
+ > alignment chain in this account. It predates `geolip-captionbert-8192` (Mar 18),
38
+ > `geolip-constellation-core` (Mar 21), the `geolip-vit-*-x3` line and
39
+ > `geolip-vit-captionbank-coco` (Jul 28), and `clip-vitb-mini-distilled` (Jul 30). It
40
+ > follows directly from `procrustes-analysis` (Mar 6), which profiled Procrustes
41
+ > alignability across 17 pretrained models in *weight* space; Bertenstein was the first
42
+ > attempt to apply the same idea in *activation* space across modalities.
43
+ >
44
+ > **A 2026-07-31 audit found the original evaluation protocol invalid, and the headline
45
+ > retrieval numbers on this card have been withdrawn and replaced below.** The
46
+ > architecture is best understood as an alignment *determinant* β€” an instrument for
47
+ > deciding whether the approach carried β€” rather than as a deployable model. The answer
48
+ > it returned was largely negative, and it was not pursued because it did not yield the
49
+ > **invariant elements needed for distillation**, which is the direction this line went
50
+ > instead.
51
+ >
52
+ > The negative result was local, not general. Later alignment work found Procrustes to
53
+ > be **substantially more capable than this prototype indicated**, and a corrected form
54
+ > of exactly this operation is now used as a standing instrument (see *Lineage*).
55
 
56
+ ---
 
 
 
 
 
 
 
 
 
 
 
 
57
 
58
+ ## What it was for
59
+
60
+ The design goal was a shared multimodal space obtained *without* training the encoders:
61
+ take independently-trained models with incompatible dimensionalities (768 / 1024 / 1280),
62
+ Procrustes-align each into a common text-anchored frame, and let a small fusion layer do
63
+ the rest. If that worked, it would be a cheap route to cross-modal association β€” and, by
64
+ extension, to distillation targets that don't require running the experts at inference.
65
+
66
+ The intended pay-off was *indirect* association: train only text↔X pairs and get X↔Y
67
+ alignment transitively through the shared text hub.
68
+
69
+ ## Corrected results
70
+
71
+ The original card reported R@1 β‰ˆ 1.0000 across all expert pairs. Those figures came from
72
+ an evaluation that encoded both modalities in a **single forward pass** and compared the
73
+ two readouts taken from that same pass β€” so the two vectors had already attended to one
74
+ another. Re-measured with independent encoding (the standard retrieval protocol):
75
+
76
+ | measurement | value | note |
77
+ |---|---|---|
78
+ | text↔image, independent encoding | **R@1 0.0007** | N=4962 COCO val, chance 0.0002 |
79
+ | text↔image, original joint-pass protocol | R@1 1.0000 | withdrawn β€” see below |
80
+ | Procrustes map alone, out-of-sample | **R@1 0.0088** | N=4962, 43.5Γ— chance; cos 0.112 vs 0.011 random |
81
+ | text↔{audio, code, protein} | withdrawn | not yet re-measured under the corrected protocol |
82
+
83
+ Three findings from the audit, kept here so the record is complete:
84
+
85
+ 1. **Joint-pass evaluation.** `<TEXT>` and `<IMAGE>` are read from one unmasked
86
+ sequence, and the training objective compares the same two readouts. That objective
87
+ is satisfiable without any cross-modal alignment. Diagnostics: R@1 stayed at 1.0000
88
+ from gallery size 64 to 4096 (real retrieval decays with gallery size), deliberately
89
+ mismatched pairs scored identically to matched ones, and the two readouts agreed at
90
+ cos 0.94 on pure-noise inputs.
91
+ 2. **The `image_coco_test` cache has no usable captions.** It was built from
92
+ COCO-Caption `split="test"`, whose annotations are withheld; upstream encodes that as
93
+ `answer: ['None']`, and the ingestion embedded the literal string. Every row is the
94
+ same 3-token sequence. The "40K test" row was additionally computed on n=5000, not
95
+ 40K. **`image_coco`, `audio_librispeech`, `code_csn` and `protein_p2t` are unaffected
96
+ and carry real text.**
97
+ 3. **The alignment figures were in-sample.** The Procrustes map is fit on the first
98
+ 5,000 rows and was reported on those same rows. The rotation maximizes the very
99
+ statistic being reported, and it has ~524k free parameters fit from 5,000 pairs; at
100
+ that ratio a no-relationship null reproduces cos β‰ˆ 0.39. The previously reported
101
+ 0.377–0.440 figures should be read as in-sample, in the whitened frame.
102
+
103
+ ### Procrustes pre-alignment β€” corrected
104
+
105
+ | Expert | dimension | reported (in-sample, whitened frame) | out-of-sample |
106
  |---|---|---|---|
107
+ | audio | 1280 β†’ 1024 (PCA) | 0.4404 | not re-measured |
108
+ | code | 768 β†’ 1024 (pad) | 0.4036 | not re-measured |
109
+ | image | 1024 β†’ 1024 | 0.4107 | **cos 0.112, R@1 0.0088** |
110
+ | protein | 1280 β†’ 1024 (PCA) | 0.3771 | not re-measured |
111
+
112
+ The out-of-sample image figure is small but **not** null β€” it sits ~43Γ— above chance and
113
+ ~17Γ— above a matched no-relationship null. Whitened Procrustes does recover real
114
+ cross-modal structure here; it was the reported *magnitude* that was an artifact of the
115
+ fit protocol.
116
+
117
+ ### Pentachoron CV
118
+
119
+ The original claim of a universal 0.20 Β± 0.01 band across modalities does not hold as
120
+ stated: CV is dimension-dependent. Measured on untrained normalized Gaussians β€”
121
+ d=16 β†’ 0.211, d=64 β†’ 0.090, d=256 β†’ 0.040, d=1024 β†’ 0.021. This model reads CV β‰ˆ 0.196
122
+ at a nominal d=1024, with an **effective rank of ~20**. That is consistent with the
123
+ 0.20 band being the natural value on S¹⁡ and the embedding having collapsed to roughly
124
+ 16–20 effective dimensions, rather than with convergence to a universal constant.
125
+ **Report effective rank alongside CV**; CV alone cannot distinguish the two.
126
 
127
  ## Architecture
128
 
 
145
  β””β”€β”€β”€β”€β”€β”€β”˜
146
  ```
147
 
148
+ **Frozen encoders** (not trained, not included here): BERT-large (336M) text hub,
149
+ DINOv2-large (302M), Whisper-large-v3 encoder (1.5B), ESM-2-650M, CodeBERT-base (125M).
150
+
151
+ **Trainable fusion** (this repo): 41.5M β€” one shared transformer layer (8.9M) plus five
152
+ expert modules (~7M each), including the Procrustes pre-alignment buffers.
153
+
154
+ **How it runs.** Each expert is centered, dimension-matched (PCA down or zero-pad up),
155
+ whitened, rotated into text space, and un-whitened. Each modality gets a projection, a
156
+ learned cross-attention pooling (257 image patches β†’ 16 tokens; 1500 audio frames β†’ 16),
157
+ a `<|MODALITY|>` token and an output head. The fusion sequence is
158
+ `[<|TEXT|>] [text] [<|IMAGE|>] [img] …` with bidirectional attention, and each modality's
159
+ embedding is read from its special-token position. Loss: InfoNCE + a pentachoron volume
160
+ term + a Procrustes alignment term.
161
+
162
+ **Known defect in that description:** because attention is unmasked across modalities and
163
+ both embeddings are read from the same sequence, the `<|TEXT|>` readout is not a function
164
+ of the text alone. Measured: it retains ~0.8% of itself when the attached image is
165
+ swapped, and ~99.5% when the *text* is swapped. An untrained model shows the same
166
+ asymmetry more mildly (34% / 59%), so this is a property of the unmasked joint sequence
167
+ that training amplified. It also means the intended *indirect* association had no
168
+ mechanism to travel on β€” alignments cannot compose through an anchor that isn't a
169
+ function of its own modality.
 
 
 
 
 
 
 
 
 
 
170
 
171
  ## Training
172
 
173
+ - **Data**: COCO-Caption (40K), LibriSpeech clean-100 (10K), CodeSearchNet Python (50K),
174
+ Protein2Text-QA (15K)
175
+ - **Schedule**: 3 epochs, round-robin across experts, cosine LR 3e-4 β†’ 1e-6, batch 256
176
+ - **Hardware**: NVIDIA RTX PRO 6000 Blackwell (102 GB) Β· **Time**: ~11 min (3 Γ— ~220s)
177
+
178
+ Precomputed embedding caches (Arrow): [`AbstractPhil/bertenstein-v1`](https://huggingface.co/datasets/AbstractPhil/bertenstein-v1)
179
+ β€” configs `image_coco`, `image_coco_test`, `audio_librispeech`, `code_csn`, `protein_p2t`.
180
+
181
+ ## Lineage β€” what carried forward
182
+
183
+ - **Whitened Procrustes cross-space alignment.** The technique held; the *fit discipline*
184
+ didn't. Its corrected descendant β€” an fp64 Procrustes frame fit with a held-out split β€”
185
+ is now a standing instrument on the distillation line, where it recovers alignment that
186
+ absolute gauges otherwise read as a floor. Procrustes turned out to be considerably
187
+ more capable than this prototype suggested.
188
+ - **Alignment to a reference member, with per-expert projectors.** Bertenstein's
189
+ soup-style construction is the direct ancestor of `geolip-captionbert-8192`'s cached
190
+ consensus, which aligns heterogeneous frozen encoders to a reference member rather than
191
+ to a running mean β€” the property that lets it fuse experts of differing dimension.
192
+ - **The move toward distillation.** What this prototype did *not* produce was an
193
+ invariant object stable enough to distill against. That gap is what redirected the line
194
+ toward consensus targets and student distillation
195
+ (`geolip-vit-captionbank-coco`, `clip-vitb-mini-distilled`), where the target is cached
196
+ and model-free at training time.
197
+ - **Evaluation discipline.** Three checks now run by default upstream of any retrieval
198
+ number: verify the query set actually varies; never score an alignment map on the rows
199
+ it was fit to; report effective rank beside CV.
200
+
201
+ ## Possible return
202
+
203
+ The idea is not closed. What it would need:
204
+
205
+ 1. **Independent encoding** β€” separate passes, or an attention mask forbidding
206
+ cross-modal attention during the contrastive computation, so the readouts are
207
+ functions of their own modality.
208
+ 2. **A held-out fit for the alignment maps**, and a smaller/regularized map: ~524k free
209
+ parameters from 5,000 samples is far past where in-sample cosine means anything.
210
+ 3. **Data that can actually test transitivity** β€” items present in two or more *non-text*
211
+ modalities (video gives audio + frames of the same event; a protein with both sequence
212
+ and structure encoders). The four corpora here are disjoint, so the central claim was
213
+ never evaluable on its own data.
214
+ 4. **A caption-validity check at ingestion** β€” the `image_coco_test` failure was a
215
+ validity flag derived from the image alone, letting empty and placeholder captions
216
+ through.
217
+
218
+ ## Files
219
 
220
  ```
221
  geolip-bertenstein/
222
  β”œβ”€β”€ checkpoints/
223
+ β”‚ β”œβ”€β”€ epoch_001/ Β· epoch_002/ Β· epoch_003/
224
+ β”‚ └── final/ model.safetensors Β· loss.safetensors Β· training_state.pt
225
+ β”‚ config.json Β· aligner_{audio,code,image,protein}.safetensors
 
 
 
 
 
 
 
 
 
 
 
 
 
226
  β”œβ”€β”€ tensorboard/
227
+ β”œβ”€β”€ bertenstein_results.json # original metrics β€” see Corrected results above
228
+ β”œβ”€β”€ cell1_prepare_data.py # Stage 1: encode + cache
229
+ β”œβ”€β”€ cell2_prototype_model_trainer_v1.py # Stage 2: align, train, evaluate
230
  └── README.md
231
  ```
232
 
233
+ `checkpoints/final/model.safetensors` contains 102 tensors; the Procrustes aligner
234
+ buffers ship inside it as `experts.<name>.aligner.*` as well as separately.
235
+ Class definitions (`BertensteinFusion`, `ExpertModule`, `ProcrustesAligner`,
236
+ `FusionConfig`) live in **`cell2_prototype_model_trainer_v1.py`** β€” earlier revisions of
237
+ this card referenced a `stage2_bertenstein.py`, which was never part of this repo.
 
 
 
 
 
 
 
 
 
 
 
238
 
239
+ ## Related
240
 
241
+ - [`AbstractPhil/procrustes-analysis`](https://huggingface.co/AbstractPhil/procrustes-analysis) β€” the weight-space profiling this grew out of
242
+ - [`AbstractPhil/geolip-captionbert-8192`](https://huggingface.co/AbstractPhil/geolip-captionbert-8192) β€” reference-member consensus, the successor construction
243
+ - [`AbstractPhil/clip-vitb-mini-distilled`](https://huggingface.co/AbstractPhil/clip-vitb-mini-distilled) β€” where the distillation direction landed
244
 
245
  ## Citation
246
 
247
  ```bibtex
248
  @misc{abstractphil2026bertenstein,
249
+ title={GEOLIP-Bertenstein: A Multimodal Procrustes Alignment Prototype},
250
  author={AbstractPhil},
251
  year={2026},
252
+ note={Archived research precursor; evaluation protocol corrected 2026-07-31},
253
  url={https://huggingface.co/AbstractPhil/geolip-bertenstein}
254
  }
255
  ```