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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# aurekai/fpqx-alignments
|
| 2 |
+
|
| 3 |
+
Feature-to-proxy quantization (FPQx) alignment repository for Aurekai. Enables zero-shot model-to-model translation and cross-model semantic routing.
|
| 4 |
+
|
| 5 |
+
## Overview
|
| 6 |
+
|
| 7 |
+
FPQx alignments establish learned mappings between feature spaces of different models, enabling Aurekai to route semantic queries across heterogeneous model architectures. This repository hosts:
|
| 8 |
+
|
| 9 |
+
- **FPQx Alignment Files**: Learned model-to-model feature mappings (`.akfpqx`, `.bffpqx`)
|
| 10 |
+
- **Alignment Metadata**: Performance metrics, training details, and validation results
|
| 11 |
+
- **Conversion Tools**: CLI utilities for translating activations between model spaces
|
| 12 |
+
- **Benchmarks**: Cross-model consistency and downstream task performance
|
| 13 |
+
|
| 14 |
+
## Quick Start
|
| 15 |
+
|
| 16 |
+
```bash
|
| 17 |
+
# Download Qwen3→LLaMA3 alignment
|
| 18 |
+
curl -L https://huggingface.co/aurekai/fpqx-alignments/resolve/main/qwen3-to-llama3.akfpqx \
|
| 19 |
+
-o qwen3-to-llama3.akfpqx
|
| 20 |
+
|
| 21 |
+
# Use with Aurekai runtime
|
| 22 |
+
akai run <recipe> \
|
| 23 |
+
--fpqx-alignment ./qwen3-to-llama3.akfpqx \
|
| 24 |
+
--target-model llama3
|
| 25 |
+
|
| 26 |
+
# Convert activations between models
|
| 27 |
+
akai fpqx:align \
|
| 28 |
+
--source-activation weights.qwen3.bin \
|
| 29 |
+
--alignment qwen3-to-llama3.akfpqx \
|
| 30 |
+
--output weights.llama3.bin
|
| 31 |
+
```
|
| 32 |
+
|
| 33 |
+
## Format Specifications
|
| 34 |
+
|
| 35 |
+
### Aurekai Format (.akfpqx)
|
| 36 |
+
|
| 37 |
+
Binary FPQx alignment in Aurekai native format:
|
| 38 |
+
|
| 39 |
+
```
|
| 40 |
+
[Header: 16 bytes]
|
| 41 |
+
- Magic: "AKFPQX"
|
| 42 |
+
- Version: 1
|
| 43 |
+
- Alignment stem: "qwen3-to-llama3"
|
| 44 |
+
|
| 45 |
+
[Source Model Spec: 64 bytes]
|
| 46 |
+
- Model name
|
| 47 |
+
- Dimension
|
| 48 |
+
- Quantization scheme
|
| 49 |
+
|
| 50 |
+
[Target Model Spec: 64 bytes]
|
| 51 |
+
- Model name
|
| 52 |
+
- Dimension
|
| 53 |
+
- Quantization scheme
|
| 54 |
+
|
| 55 |
+
[Alignment Matrix: variable]
|
| 56 |
+
- Feature projection weights
|
| 57 |
+
- Quantization boundaries
|
| 58 |
+
- Proxy indicators
|
| 59 |
+
|
| 60 |
+
[Metadata: variable]
|
| 61 |
+
- Training date
|
| 62 |
+
- Accuracy metrics
|
| 63 |
+
- Hardware specs
|
| 64 |
+
|
| 65 |
+
[Signature: 32 bytes (SHA256)]
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
### Legacy Bonfyre Format (.bffpqx)
|
| 69 |
+
|
| 70 |
+
Legacy format for backward compatibility with Bonfyre runtime:
|
| 71 |
+
- Same underlying alignment data
|
| 72 |
+
- Different metadata layout and serialization
|
| 73 |
+
- Auto-converted by Aurekai runtime
|
| 74 |
+
|
| 75 |
+
## Available Alignments
|
| 76 |
+
|
| 77 |
+
### Qwen3-8B ↔ LLaMA3-8B
|
| 78 |
+
|
| 79 |
+
- **File**: `qwen3-to-llama3.akfpqx` / `qwen3-to-llama3.bffpqx`
|
| 80 |
+
- **Direction**: Qwen3 → LLaMA3 (reversible)
|
| 81 |
+
- **Accuracy**: 94.2% semantic preservation (evaluated on 10K examples)
|
| 82 |
+
- **Latency**: ~1.2ms per sample alignment
|
| 83 |
+
- **Training**: Calibrated on shared instruction tuning corpus
|
| 84 |
+
- **Size**: ~8 MB
|
| 85 |
+
|
| 86 |
+
**Performance Metrics**:
|
| 87 |
+
- Activation MSE: 0.003
|
| 88 |
+
- Cosine similarity (after alignment): 0.96
|
| 89 |
+
- Downstream task delta: +0.3% average
|
| 90 |
+
- Zero-shot transfer success: 89%
|
| 91 |
+
|
| 92 |
+
### Adding New Alignments
|
| 93 |
+
|
| 94 |
+
To contribute a new alignment:
|
| 95 |
+
|
| 96 |
+
1. Train alignment matrix using Aurekai alignment pipeline:
|
| 97 |
+
```bash
|
| 98 |
+
akai fpqx:train \
|
| 99 |
+
--source-model qwen3-8b \
|
| 100 |
+
--target-model llama3-8b \
|
| 101 |
+
--calibration-set corpus.jsonl \
|
| 102 |
+
--output alignment.akfpqx
|
| 103 |
+
```
|
| 104 |
+
|
| 105 |
+
2. Validate alignment quality:
|
| 106 |
+
```bash
|
| 107 |
+
akai fpqx:validate \
|
| 108 |
+
--alignment alignment.akfpqx \
|
| 109 |
+
--test-set validation.jsonl
|
| 110 |
+
```
|
| 111 |
+
|
| 112 |
+
3. Submit PR with alignment file and validation report
|
| 113 |
+
|
| 114 |
+
## Integration with Aurekai
|
| 115 |
+
|
| 116 |
+
### Environment Variables
|
| 117 |
+
|
| 118 |
+
```bash
|
| 119 |
+
export AUREKAI_FPQX_ALIGNMENT=./qwen3-to-llama3.akfpqx
|
| 120 |
+
export AUREKAI_TARGET_MODEL=llama3-8b
|
| 121 |
+
export AUREKAI_ALIGNMENT_CACHE=/tmp/alignment-cache
|
| 122 |
+
```
|
| 123 |
+
|
| 124 |
+
### Manifest Registration
|
| 125 |
+
|
| 126 |
+
**aurekai.manifest.json**:
|
| 127 |
+
```json
|
| 128 |
+
{
|
| 129 |
+
"fpqx_alignments": [
|
| 130 |
+
{
|
| 131 |
+
"stem": "qwen3-to-llama3",
|
| 132 |
+
"akfpqx": "aurekai/fpqx-alignments/qwen3-to-llama3.akfpqx",
|
| 133 |
+
"bffpqx": "aurekai/fpqx-alignments/qwen3-to-llama3.bffpqx",
|
| 134 |
+
"accuracy": 0.942,
|
| 135 |
+
"bidirectional": true
|
| 136 |
+
}
|
| 137 |
+
]
|
| 138 |
+
}
|
| 139 |
+
```
|
| 140 |
+
|
| 141 |
+
### Activation Translation
|
| 142 |
+
|
| 143 |
+
```bash
|
| 144 |
+
# Direct translation of model activations
|
| 145 |
+
akai fpqx:align \
|
| 146 |
+
--source-model qwen3-8b \
|
| 147 |
+
--target-model llama3-8b \
|
| 148 |
+
--input-activations source-layer-10.bin \
|
| 149 |
+
--alignment qwen3-to-llama3.akfpqx \
|
| 150 |
+
--output target-layer-10.bin
|
| 151 |
+
|
| 152 |
+
# Batch alignment
|
| 153 |
+
akai fpqx:batch-align \
|
| 154 |
+
--alignment qwen3-to-llama3.akfpqx \
|
| 155 |
+
--input-dir ./qwen3-activations/ \
|
| 156 |
+
--output-dir ./llama3-activations/
|
| 157 |
+
```
|
| 158 |
+
|
| 159 |
+
## Cross-Model Routing
|
| 160 |
+
|
| 161 |
+
FPQx alignments enable semantic routing across models:
|
| 162 |
+
|
| 163 |
+
```javascript
|
| 164 |
+
// In Aurekai operator
|
| 165 |
+
const router = new SemanticRouter({
|
| 166 |
+
models: ["qwen3-8b", "llama3-8b"],
|
| 167 |
+
alignments: ["qwen3-to-llama3.akfpqx"]
|
| 168 |
+
});
|
| 169 |
+
|
| 170 |
+
// Route query to appropriate model
|
| 171 |
+
const response = await router.query(semanticQuery);
|
| 172 |
+
// → Automatically handles model translation and cache harmonization
|
| 173 |
+
```
|
| 174 |
+
|
| 175 |
+
## Validation & Benchmarks
|
| 176 |
+
|
| 177 |
+
Each alignment includes validation metrics:
|
| 178 |
+
|
| 179 |
+
- **Semantic Preservation**: Cosine similarity after alignment
|
| 180 |
+
- **Task Performance**: Downstream accuracy delta
|
| 181 |
+
- **Zero-shot Transfer**: Cross-model capability retention
|
| 182 |
+
- **Latency**: Per-sample alignment time
|
| 183 |
+
- **Memory**: Peak memory during alignment computation
|
| 184 |
+
|
| 185 |
+
Run benchmarks locally:
|
| 186 |
+
|
| 187 |
+
```bash
|
| 188 |
+
akai fpqx:benchmark \
|
| 189 |
+
--alignment qwen3-to-llama3.akfpqx \
|
| 190 |
+
--benchmark-suite semantic-routing
|
| 191 |
+
```
|
| 192 |
+
|
| 193 |
+
## Tools & Commands
|
| 194 |
+
|
| 195 |
+
- `akai fpqx:train`: Train new alignment between models
|
| 196 |
+
- `akai fpqx:validate`: Validate alignment quality
|
| 197 |
+
- `akai fpqx:align`: Translate activations between models
|
| 198 |
+
- `akai fpqx:batch-align`: Batch alignment processing
|
| 199 |
+
- `akai fpqx:benchmark`: Run performance benchmarks
|
| 200 |
+
- `fpqx_convert.py`: Legacy Bonfyre → Aurekai format converter
|
| 201 |
+
|
| 202 |
+
## Related Repositories
|
| 203 |
+
|
| 204 |
+
- **Main Aurekai Repo**: https://github.com/aurekai/aurekai
|
| 205 |
+
- **Model Memory**: https://huggingface.co/aurekai/model-memory
|
| 206 |
+
- **SAE Dictionaries**: https://huggingface.co/aurekai/sae-dictionaries
|
| 207 |
+
- **Semantic Cache Bench**: https://huggingface.co/aurekai/semantic-cache-bench
|
| 208 |
+
|
| 209 |
+
## Citation
|
| 210 |
+
|
| 211 |
+
If you use these FPQx alignments, please cite:
|
| 212 |
+
|
| 213 |
+
```bibtex
|
| 214 |
+
@dataset{aurekai_fpqx_alignments_2026,
|
| 215 |
+
title={Aurekai FPQx Alignment Repository},
|
| 216 |
+
author={Aurekai Community},
|
| 217 |
+
year={2026},
|
| 218 |
+
url={https://huggingface.co/aurekai/fpqx-alignments}
|
| 219 |
+
}
|
| 220 |
+
```
|
| 221 |
+
|
| 222 |
+
## License
|
| 223 |
+
|
| 224 |
+
Licensed under the Aurekai Open Source License. See main Aurekai repository for full license terms.
|