A bounded diamond is the canonical shape used to represent concepts in AGISystem2. It combines an axis-aligned box (capturing hard constraints) with an L1 ball (capturing typicality gradients), producing a shape that models both necessary conditions and graded membership.

2D Projection Box (min/max) L1 Ball Bounded Diamond center radius Data Structure center: Int8Array(384) The prototype point of the concept min/max: Int8Array(384) Hard boundaries per dimension radius: number L1 distance from center mask: Uint8Array(384) Which dimensions are relevant

A bounded diamond is the intersection of a box and an L1 ball. The box defines hard min/max constraints per dimension. The L1 ball defines a typicality gradient around the center. The mask specifies which dimensions matter for this concept.

How It Works

When the system receives a new fact about a concept, the ClusterManager decides whether to expand an existing diamond or create a new one. Expansion involves adjusting the center, widening the box boundaries, or increasing the radius. If the new point is too far from any existing diamond, a fresh diamond is created.

Containment testing checks whether a query point falls inside a diamond. A point is inside if: (1) it satisfies all box constraints (each dimension within min/max), and (2) the masked L1 distance from the center is within the radius. This two-part check models both hard categorical boundaries and soft typicality.

The mask allows context-sensitive reasoning. When comparing concepts in a domain-specific context, irrelevant dimensions can be masked out. For example, comparing animals by behavior might mask color dimensions. The Masked L1 Distance wiki page explains this in detail.

Implementation in AGISystem2

The BoundedDiamond class in the Geometry Layer provides the core operations:

OperationDescription
contains(point) Check if point is inside the diamond
distance(point) Compute masked L1 distance to center
expand(point) Grow to include a new point
intersects(other) Check if two diamonds overlap
union(other) Create diamond covering both regions

Why This Shape?

Bounded diamonds balance expressiveness with efficiency. Boxes alone cannot model typicality gradients. L1 balls alone cannot enforce hard per-dimension constraints. The intersection gives both: hard boundaries where needed, soft gradients where appropriate. Additionally, L1 geometry (Manhattan distance) works well with int8 arithmetic and avoids the precision issues of Euclidean distance.

Related Documentation