FractalWorkspace README

The project's README from github.com/AhmadHassan-BTed/FractalWorkspace. As one markdown file: README.md.

Fractal Banner

Fractal

Distributed Compute Orchestration and Edge Intelligence Framework

License Platform Design Status Architecture Maintainer

A unified distributed systems framework bridging centralized model orchestration with decentralized edge intelligence.

Overview | Design Case Study | Architecture | Core Paradigms | Repository Topology | Getting Started | Security


Overview

Fractal is a high-performance distributed computing ecosystem engineered to harvest fragmented consumer compute across mobile edge devices while strictly preserving user privacy and device health. The framework treats edge devices not merely as remote processors, but as autonomous, resource-constrained nodes operating under human-centric constraints.

The ecosystem resolves the computational and memory walls of foundation models through two distinct, unified systems:

  1. FractalCore (Central Server & Orchestrator): The Python-based control plane responsible for multi-tenant isolation, dataset segment allocation, model graph compilation/slicing, deterministic federated weight aggregation (FedAvg), compute budgeting, and tokenized reward distribution.
  2. FractalAndroid (Edge Compute Node & Application): The native Kotlin/Android execution engine running on mobile hardware. It performs hardware-gated on-device training and memory-mapped inference, dynamically pausing workloads if thermals or battery thresholds are exceeded.

Ecosystem Subsystems

Central Server (FractalCore) Edge Compute Node (FractalAndroid)
Tenant Dashboard

Multi-Tenant Dashboard: Real-time fleet tracking, segment dispatch, and live aggregation telemetry.

Android Active Node

Edge Node: On-device training & telemetry.


System Architecture

Fractal operates on a hierarchical Master-Worker architecture designed to isolate control signals from mathematical payloads.

graph TD
    subgraph ControlPlane ["Control Plane (FractalCore Server)"]
        direction TB
        API["REST Gateway & Auth Controller"]
        TM["Tenant Isolation Manager"]
        TS["Task Scheduler & Segment Dispatcher"]
        FA["Federated Weight Aggregator (FedAvg)"]
        Slicer["Graph Slicer & INT4 Quantizer"]
        Budget["TFLOPs Budget Controller"]
    end

    subgraph DataPlane ["Data Plane (FractalAndroid Edge Nodes)"]
        direction TB
        N1["Android Node A (Layers 0-7 / Worker)"]
        N2["Android Node B (Layers 8-15 / Worker)"]
        N3["Android Node C (Layers 16-23 / Worker)"]
        N4["Android Node D (Layers 24-31 / Worker)"]
    end

    subgraph PersistenceLayer ["Persistence & Ledger"]
        FS[("Firestore Ledger (Tokens / Rewards / Nodes)")]
        Disk[("Physical Data Silos (Bins / Checkpoints / PTE Slices)")]
    end

    %% Control Plane Internal Flow
    API --> TM
    TM --> TS
    TS --> Budget
    FA --> Disk
    Slicer --> Disk
    API --> FS

    %% Network Interactions
    N1 & N2 & N3 & N4 <-->|"REST API / TLS (Task Polling & Weight Uploads)"| API
    N1 -->|"INT8 Activation Stream (Wi-Fi Socket)"| N2
    N2 -->|"INT8 Activation Stream (Wi-Fi Socket)"| N3
    N3 -->|"INT8 Activation Stream (Wi-Fi Socket)"| N4

Operational Paradigms

Fractal executes distributed machine learning through two foundational paradigms:

1. Federated Learning (On-Device Training)

In the federated learning lifecycle, raw training datasets are never transferred to the central server. The server partitions data indices into segment bins, dispatches task descriptors to registered Android nodes, and waits for computed checkpoint deltas (.ckpt).

sequenceDiagram
    participant Tenant as Tenant / Administrator
    participant Server as FractalCore Server
    participant Node as FractalAndroid Node
    participant Firestore as Firestore Registry

    Tenant->>Server: Initialize Session (Dataset + TFLOP Budget)
    Server->>Server: Partition Dataset into Binary Segment Bins
    Note over Server: Queue Tasks in Tenant Silo

    Node->>Server: GET /api/task/current (Hardware Telemetry Proof)
    Server-->>Node: ActiveTask (Model URL + Data Bin URL + Hyperparams)

    Node->>Node: Evaluate Telemetry Permit (Battery >= 50%, Thermals <= 40C)
    Node->>Server: Download Model Weights (.tflite) + Binary Bins
    Node->>Node: Execute Local Gradient Descent (TFLite Engine)
    Node->>Server: POST /api/model/upload (Checkpoint Delta .ckpt)

    Server->>Firestore: Credit Liquid MBs to Node Device ID
    Server->>Server: Federated Averaging (FedAvg Summation)
    Server->>Server: Increment Global Model Round

2. Decentralized Pipeline Parallelism (Large Foundation Model Inference)

To execute foundation models (such as Llama 3 8B or TinyLlama) across edge devices without triggering the Android Low Memory Killer (LMK), Fractal Core slices the monolithic model into memory-bounded partitions (layer_[N].pte <= 150MB). Each Android node memory-maps (mmap) an assigned partition and transmits quantized activation tensors across an ad-hoc local mesh.

flowchart LR
    subgraph CoreSlicer ["FractalCore Compiler"]
        M16["Monolithic 16GB FP16 Checkpoint"] --> Ingest["Ingestion & Block Isolation"]
        Ingest --> Quant["INT4 Weight Quantization (torchao)"]
        Quant --> Trace["ATen Dialect Graph Trace (torch.export)"]
        Trace --> Lower["XNNPACK Hardware Delegation"]
        Lower --> Out["32x Mapped Partitions (layer_N.pte <= 150MB)"]
    end

    subgraph EdgeMesh ["Android Compute Mesh"]
        Out -.->|"Deploy Layer Partition"| NodeA["Node A (Input / Layer 0-7)"]
        NodeA -->|"INT8 Activations (<= 4.1KB)"| NodeB["Node B (Layer 8-15)"]
        NodeB -->|"INT8 Activations (<= 4.1KB)"| NodeC["Node C (Layer 16-23)"]
        NodeC -->|"INT8 Activations (<= 4.1KB)"| NodeD["Node D (Output / Layer 24-31)"]
    end

Global System Contracts

The ecosystem maintains strict operational boundaries governed by mathematical contracts:

Contract Target Subsystem Strict Specification Failure Behavior
Weight Contract Model Slicing & Storage Binary partition (.pte / .tflite) strictly $\le$ 150MB Slicer compilation rejected
Activation Contract Pipeline Inter-Node Network 4096-dim INT8 tensor + 1 Float scale strictly $\le$ 4,100 bytes Network frame dropped and re-requested
Telemetry Permit On-Device Execution Gate Battery $\ge$ 50%, Charging == True, Battery Temp $\le$ 40.0 C Training paused immediately
Authentication Contract REST Ingress Gateway X-Auth-Token required for all tenant and administrative routes HTTP 401 / 403 response
Upload Validation Federated Aggregation Gate task_Id must match an active unconsumed dispatch record HTTP 400 Unknown task_Id

Repository Topology

The Fractal ecosystem is partitioned across dedicated modular repositories:

.
|-- FractalApp/
|   `-- FractalAndroid/              # Client Application & Compute Node (Kotlin)
|       |-- app/src/main/java/       # Native MVVM Architecture
|       |   |-- AppBackend/          # Telemetry, TFLite Engine, Checkpointing, DAOs
|       |   `-- AppFrontend/         # Telemetry Dashboard, Insights & Settings
|       |-- build.gradle.kts         # Android Build Configuration (Kotlin DSL)
|       `-- docs/                    # Architecture diagrams and specifications
|
|-- FractalCore/                     # Server & Control Plane (Python)
|   |-- src/
|   |   |-- fractal_server/          # Multi-Tenant Flask API & Federated Aggregator
|   |   `-- inference-model-maker/   # Slicer Compiler & Model Partitioning Pipeline
|   |-- scripts/                     # Operational Sweepers, Testers & Reward Audits
|   |-- docs/                        # API schemas, deployment, and security specs
|   |-- Dockerfile                   # Production Container Definition
|   `-- docker-compose.yml           # Multi-Container Orchestration Stack
|
|-- docs/                            # Unified Project Whitepapers & Reports
`-- private.envs/                    # Private Environment Configurations & Service Keys

Getting Started

Prerequisites

Cloning with Submodules

To initialize the entire workspace including all submodule repositories:

git clone --recursive https://github.com/Fractal-Compute-Orchestrations/FractalWorkspace.git

If the repository was cloned without --recursive, initialize submodules manually:

git submodule update --init --recursive

Initializing the Orchestrator (FractalCore)

cd FractalCore
cp .env.example .env

# Launch production server via Docker Compose
docker-compose up --build -d

# Verify server status
curl http://localhost:5000/api/admin/tenants

Initializing the Edge Client (FractalAndroid)

cd FractalApp/FractalAndroid

# Build project with Gradle
./gradlew assembleDebug

# Install on connected physical device
./gradlew installDebug

Security and Privacy


Governance & Licensing

Fractal is architected and owned by Ahmad Hassan (B-Ted).

FractalWorkspace (AhmadHassan-BTed/FractalWorkspace)

Searching Database…

What is this?Fractal is a distributed computing ecosystem for federated learning that harvests spare compute from mobile edge devices while keeping raw user data on-device. It pairs a Python-based central orchestrator with a native Android client that trains models locally and only sends back weight checkpoints.
Is this one app or a client-server system?It is two linked subsystems shipped as separate repos pulled in via git submodules: FractalCore, a Python control plane that runs on a server, and FractalAndroid, a Kotlin/Android app that trains and infers on the phone.
How do I get the whole workspace running?Clone the repo with --recursive to pull in all submodules (or run 'git submodule update --init' afterwards), then initialize FractalCore on the server side and build FractalAndroid separately in Android Studio.
What do I need installed before trying this?You need Python 3.10+ for FractalCore, Android Studio 2023.3.1 (Jellyfish) or newer for the client, a physical Android device on API 24+ (ARM64 recommended), and a Firebase project with Firestore enabled.
Does training just run whenever the app is open?No, the edge node enforces a hardware gate: training only proceeds when the device is charging, battery is above a threshold, and temperature is within a safe range, and it pauses immediately if thermals or battery slip.
Does my raw data ever leave my phone?No. The server design is 'zero data ingress' — only compiled mathematical weight checkpoints are transmitted, and tenant data is further isolated into sandboxed per-user directory trees on the server.
Can I use this commercially?No, Fractal uses a proprietary, source-available license that explicitly bans commercial use without written authorization from the author.
What does FedAvg do here?FractalCore uses FedAvg to deterministically aggregate the weight-delta checkpoints uploaded by edge nodes into an updated global model, without ever seeing the raw training data behind them.
Can it run large models like Llama 3 8B across phones?Yes, via decentralized pipeline parallelism: FractalCore slices a large foundation model into partitions no bigger than 150MB, and each Android node memory-maps one partition and exchanges quantized INT8 activation tensors over a local mesh.
Why the strict 150MB partition size limit?It keeps each memory-mapped model shard small enough that loading it on a phone won't trigger Android's Low Memory Killer, which would otherwise kill the inference process.
How is data kept separate between different tenants on the server?Each tenant's datasets, segment bins, and intermediate checkpoints are stored in physically isolated directory trees (data/tenants/{username}/) rather than shared storage.
Size
47.4 MB
Stars
1.2K
Updated
CommitAug 22
Age
3mo
Commits · 90 Days