# Core Concepts Explained

HEAL is a runtime framework for executing AI models over structured polynomial data using an efficient and hardware-aligned approach. Central to this system are the concepts of **tensors**, **transcripts**, and **pointer-based memory interaction**.&#x20;

Here, we outline the essential concepts that form the foundation of HEAL, with additional links provided for deeper technical insights.

## Key Concepts

### 1. **Tensors as Core Data Structures**

In HEAL, data is organized into **tensors**, which:

* Have clearly defined **shapes** (logical dimensions) and **strides** (physical memory layouts). The **data type** (int32 or int64) defines what kind of values the tensor can store.
* For operations involving polynomial arithmetic, tensor shapes follow a structured convention:
  * One axis has length ***n***, which represents the size of the polynomial evaluation domain.
  * Another axis corresponds to the number of residues in the Double-CRT representation.
* Can be non-continuous in memory, facilitating flexible compatibility with various hardware architectures.

[Learn more about tensor design →](https://healdocs.lattica.ai/core-concepts-explained/tensor)

***

### 2. **Pointer-Based Function Interfaces**

HEAL uses a pointer-based memory approach:

* Functions do **not** manage memory internally. Instead, they receive pointers to input and output tensors.
* The host directs the device to allocate memory regions and provides pointers to these regions when invoking device functions, reducing overhead and improving efficiency.
* This model closely aligns with typical hardware APIs, simplifying integration and execution.

[See detailed explanation of host/device interaction →](https://healdocs.lattica.ai/core-concepts-explained/memory-and-execution-model)

***

### 3. **Transcripts as Runtime Execution Records**

Transcripts are structured JSON files that:

* Detail the exact sequence of operations, including tensor inputs, outputs, and functions to run.
* Provide a clear execution path for running AI models.
* Are processed sequentially by the HEAL runtime script, ensuring correct execution order and data handling.

Explore the HEAL [transcript ](https://healdocs.lattica.ai/core-concepts-explained/transcript)and [runtime ](https://healdocs.lattica.ai/core-concepts-explained/runtime)system →

***

### 4. Flexible and Incremental Function Implementation

HEAL supports gradual integration and optimization:

* We supply a comprehensive specification document that outlines all functions required in HEAL transcript.
* Provided example implementations (in C++) serve as clear references and temporary solutions during initial hardware implementation stages.
* The transcript is configurable and specifies which implementation layer to use for each function, allowing seamless integration of hardware and software implementations.
  * Hardware teams can implement functions incrementally (managing complexity and optimizing performance step by step), or implement only a subset of functions if their hardware doesn't support all capabilities.
  * Also, transcripts can be adapted to integrate optimized hardware-specific high-level functions (such as `key_switch`), eliminating the need for extensive runtime modifications.

[Review the function spec and implementation approach →](https://healdocs.lattica.ai/interface-specifications)

***

### 5. Unit Tests and Validation Suite

To ensure robust implementation:

* HEAL offers an extensive suite of unit tests.
* These tests, downloadable from GitHub, provide clear and standardized logs detailing pass/fail status and performance metrics.
* The standardized test suite aids debugging, ensuring the correctness and reliability of hardware implementations.

[Download the test suite and explore validation tools](https://github.com/Lattica-ai/heal) →

***
