Skip to content

[Proposal] Introspection Engine for Automatic Backend Tuning & Advisory (GSoC 2026) #1753

@ayush4874

Description

@ayush4874

Hi @mstimberg and @thesamovar,

Following up on the discussion in #1729 regarding Dan's idea of an "Auto-Switch" or "Smart Heuristic" for backend selection, I have drafted a preliminary technical proposal for GSoC 2026.

The Core Concept

I propose building a ComplexityCrawler that runs inside Network.before_run(). It inspects the computational cost of the network (neuron count, synapse sparsity, duration) and serves two functions:

  1. Runtime Optimization: Automatically selects the most efficient Runtime target (numpy, cython, or the upcoming cppyy) based on startup cost vs. execution speed.
  2. Scalability Advisor: Detects when a simulation is too heavy for any Python-driven runtime (due to the Network.run loop overhead) and explicitly warns the user to switch to set_device('cpp_standalone') for massive speedups.

The Draft Proposal

I have outlined the technical mechanism, the "Tiered Cost Model", and implementation phases here:
https://gist.github.com/ayush4874/d2bf639b772049bd3465951bfea8c307

Technical Note

My initial idea considered "seamlessly swapping" to cpp_standalone automatically. However, swapping to Standalone mode inside before_run (after objects are already initialized in Python) is likely architecturally unsafe.

Therefore, this proposal focuses on advising for Standalone mode (Tier 3) via warnings, while reserving automatic switching for the Runtime targets (Tier 1 & 2) where it is safe to do so.

I’ve prototyped the "Scoring" logic locally (prototype_v2_crawler.py) and it successfully distinguishes between "toy", "standard", and "heavy" networks. I would love your feedback on this architecture.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions