Skip to content

🌍 [FEATURE] Distributed Edge-Compute Mesh β€” Crowdsourced On-Device AI Inference Without a ServerΒ #14

Description

@MindFuq001

Overview

This feature eliminates the dependency on centralized AI API servers entirely by turning every instance of opencode-android into a node in a distributed edge-compute mesh. When your device needs AI inference but lacks local compute power, it silently routes the task to nearby trusted devices in the mesh β€” splitting the workload across multiple phones, tablets, or Android TV boxes.


Why This Is Revolutionary

Currently, mobile AI coding assistants face a hard tradeoff:

  • Cloud inference: Fast but requires internet, exposes your code to servers, costs money
  • On-device inference: Private and free but crushingly slow on most Android hardware

The mesh breaks this tradeoff entirely. Your code stays encrypted and private, but you get near-cloud inference speeds using idle CPU/GPU cycles from devices around you.


Architecture: Sovereign Inference Network (SIN)

Node Discovery

Nodes discover each other through three channels (in priority order):

  1. Local WiFi broadcast β€” fastest, zero latency, used for home/office networks
  2. Bluetooth LE beacons β€” proximity-based, no WiFi needed
  3. Encrypted DHT overlay β€” internet-based fallback using a distributed hash table (like BitTorrent)

Task Splitting

Large inference tasks (e.g., analyzing a 2,000-line file) are split using tensor parallelism:

data class InferenceShard(
    val shardId: UUID,
    val layerRange: IntRange,      // e.g., layers 0-12 of a 32-layer model
    val inputTokens: EncryptedBlob,
    val encryptionKey: ByteArray,
    val deadline: Long             // milliseconds until shard expires
)

fun distributeInferenceTask(task: InferenceTask, mesh: MeshTopology): List<InferenceShard> {
    return TensorShardingEngine.split(
        task = task,
        nodes = mesh.availableNodes.sortedBy { it.computeScore },
        strategy = ShardingStrategy.PIPELINE_PARALLEL
    )
}

Privacy Guarantees

  • Each shard is individually meaningless β€” a node running shard 3 of 8 sees only a fragment of encrypted activations with no access to the original tokens
  • Shards are encrypted with ephemeral keys that expire after the task completes
  • No node ever accumulates enough information to reconstruct your code

Contribution & Reputation

  • Devices that contribute compute earn Compute Credits stored locally
  • Credits are spent when your device needs to offload tasks
  • A reputation system penalizes nodes that return corrupted or slow results
  • Optional: contribute anonymously with zero-account setup

Android Implementation Highlights

  • Uses Android's WorkManager for background shard processing that respects battery and thermal constraints
  • Integrates with Android Nearby API for peer discovery without Bluetooth pairing
  • Thermal throttling detection pauses contribution when device temperature exceeds 42Β°C
  • Sharding engine written in Kotlin/Native with NNAPI acceleration for the inference computation

Acceptance Criteria

  • Node discovery via WiFi completes in < 3 seconds on same subnet
  • Minimum viable mesh: 3 nodes, each handling 1/3 of inference layers
  • Shard encryption uses AES-256-GCM with 60-second TTL keys
  • Battery impact capped at 5% per hour when contributing
  • Full fallback to local-only inference if mesh unavailable
  • Compute credits ledger is append-only, tamper-evident, local-first
  • No central coordinator server required at any point

"Your phone is more powerful than a 2010 supercomputer. Why is it sitting idle while your AI waits for a server response?"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions