# 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 →](/core-concepts-explained/tensor.md)

***

### 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 →](/core-concepts-explained/memory-and-execution-model.md)

***

### 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 ](/core-concepts-explained/transcript.md)and [runtime ](/core-concepts-explained/runtime.md)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 →](/interface-specifications.md)

***

### 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) →

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://healdocs.lattica.ai/core-concepts-explained.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
