Skip to main content

Mixture of Convex Experts (MiCE) for PyTorch

Project description

MiCE (Mixture of Convex Experts)

What is MiCE?

MiCE is a lightweight PyTorch library for building convex mixture-of-experts models via a novel max-of-means atlas. Instead of softmax routing or hard top-k gating, MiCE fuses an ensemble of convex “petal” subnetworks with a fixed, irreducible atlas of affine charts:

  1. Forward projection into each petal’s chart
  2. Convex evaluation in chart space (Input-Convex Neural Nets)
  3. (Optional) exact inversion back to the global frame
  4. Overlapping mean-of-pairs + max fusion

This guarantees convexity, interpretability, and efficient compute without exponentials or discrete dispatch- but only inside the petals, for now. Convexity distortions do happen at the edge of petals, and work is ongoing to evaluate this problem.

Why MiCE?

  • Global convexity
    Each chart is convex; max-fusion preserves convexity in any dimension.

  • Two operating modes

    • Forward-only (invert=False): fast chart tiling with learnable shifts
    • Atlas mode (invert=True): full chart atlas with exact reprojection, no shifts needed
  • Efficiency
    No softmax, no log-sum-exp, no sparse dispatch. Fusion is just a handful of GEMMs, adds, and a single max per group. Compute scales ~2.6× a 2-layer MLP.

  • Interpretability
    Clear regions of dominance — visualize arg-max and margins over petals in any 2-D slice.


Feature Comparison

Feature MiCE (MoMx) Softmax MoE Hard MoE Standard MLP
Routing max(mean(…)) softmax(weights) top-k mask none
Convexity ✅ (vector-valued) ✅ (scalar only)
Atlas inversion optional (invert)
Compute cost ~2.6× MLP >10× (exp/log) ~k× experts baseline
Params ~2.6× MLP high high baseline
Gradient smoothness high (piecewise convex) smooth sparse smooth
Interpretability high medium low low

Installation

pip install torch-mice

import torch
from torch_mice import VectorHull

# Forward-only mode (default):
hull = VectorHull(in_dim=512, petals=8, out_dim=512, invert=False)
y_fwd = hull(x)

# Full atlas mode with exact inversion:
hull_atlas = VectorHull(in_dim=512, petals=8, out_dim=512, invert=True)
y_atlas = hull_atlas(x)

License

Licensed under the Gratis Public License © 2025 Joshuah Rainstar

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

torch_mice-0.4.2.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

torch_mice-0.4.2-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

Details for the file torch_mice-0.4.2.tar.gz.

File metadata

  • Download URL: torch_mice-0.4.2.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for torch_mice-0.4.2.tar.gz
Algorithm Hash digest
SHA256 b6a69e5bb9ce6c30020a92c7cdbc46497be8b931b32a8c6a50b376f3d393f273
MD5 98bc02ff64e06f0eaabb0ca104e7ad31
BLAKE2b-256 1dec2792fe0e6842b7497565523b62bf5fd9ec8f02123af893f18381ca78cb4e

See more details on using hashes here.

File details

Details for the file torch_mice-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: torch_mice-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 15.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for torch_mice-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9475358d423a26ba706904bd1e9e9ad8c6df9297b39f67e7f6b043a93432a566
MD5 66ad9dc946c563e2025451a305beebdb
BLAKE2b-256 588a0312197f222e30b8bb36baa2e111e9739eedacc18f6a9b79d3d5c1cc7ee0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page