Masked L1 distance is the primary similarity metric in AGISystem2. It measures the Manhattan distance between two vectors, but only considers dimensions marked as relevant by a mask. This enables context-sensitive comparisons where different dimensions matter in different situations.
The mask determines which dimensions count. Dimensions with mask=1 contribute their absolute difference to the total. Dimensions with mask=0 are ignored. This allows context-sensitive similarity comparisons.
Not all dimensions are relevant in every context. When comparing animals by behavior, physical appearance dimensions might be irrelevant. When comparing products by price, brand dimensions might not matter. The mask provides this flexibility without requiring different vector representations for different contexts.
AGISystem2 uses separate dimension ranges for ontological (factual) and axiological (value) information. The BiasController can automatically mask value dimensions when pure factual comparisons are needed, enabling the "veil of ignorance" mode for fair reasoning.
The MathEngine provides optimized distance computation:
// Basic masked L1 distance const dist = mathEngine.maskedL1(vectorA, vectorB, mask); // With ontology-only mask (dims 0-255) const ontoDist = mathEngine.maskedL1(vectorA, vectorB, ontologyMask); // With full mask (all 384 dims) const fullDist = mathEngine.maskedL1(vectorA, vectorB, fullMask);
| Mask Type | Dimensions | Use Case |
|---|---|---|
| Full mask | All 384 | Complete similarity including values |
| Ontology mask | 0-255 | Factual similarity only (veil of ignorance) |
| Axiology mask | 256-383 | Value similarity only |
| Custom mask | User-defined | Domain-specific comparisons |
L1 distance sums absolute differences rather than squared differences (L2/Euclidean). This has practical advantages: