Observation-Driven Adaptive Routing (ODAR) — belief-driven routing engine for heterogeneous LLM pools. Python port of @arcasha/router (ArcAsha core).
Project description
arcasha-router (Python)
Observation-Driven Adaptive Routing (ODAR) — belief-driven routing engine for
heterogeneous LLM pools. Python port of @arcasha/router
(ArcAsha のルーティングコア)。依存なし (pure Python) で、WebGPU アプリや
エッジ AI プロジェクトに埋め込めます。
インストール
pip install -e . # 開発 (このディレクトリから)
# または (公開後): pip install arcasha-router
使い方 (フル情報 / シャドウループ)
from arcasha_router import (
BayesianBelief, LinUCBShadowRouter, compute_rewards, find_oracle,
)
experts = [
{"nodeId": "node-a", "modelId": "M1", "family": "qwen", "paramsM": 596, "memoryGB": 1.2, "temperature": 0.6},
# ...
]
router = LinUCBShadowRouter(experts) # alpha=0.3, lambda=1.0
# 1 ステップ: 全エキスパート評価 (shadow) → 報酬 → 選択 → Full-Information 更新
ctx = {
"task": {"id": "t1", "capability": "coding", "prompt": "..."},
"states": states, # nodeId -> {"capability": {...}, "latencyMs": int, "stability": float}
"rewards": rewards, # compute_rewards(experts, results, states, max_lat, max_params)
"order": [e["nodeId"] for e in experts],
"step": step,
}
chosen = router.select(ctx)
router.observe(ctx) # 全アームの報酬で更新
API
| シンボル | 内容 |
|---|---|
BayesianBelief / EmaLatency |
状態推定 (μ, confidence=1-exp(-n/8), effective, 事前分布シード) |
LinUCBShadowRouter |
提案手法 (disjoint LinUCB + シャドウ = フル情報) |
UCBShadowRouter / FixedRouter / RandomRouter / RoundRobinRouter |
ベースライン |
build_features |
8 次元特徴量 |
compute_rewards / find_oracle |
多目的報酬 (Q+L+C+S) と Oracle |
evaluate_all / evaluate_task |
ルールベース評価 + シャドウ実行 (async) |
検証
cd packages/arcasha-router-py
python demo.py
出力例 (合成プール): LinUCB-Shadow が 60 ステップで最良ノード (node-b) を即学習 し、regret=0。UCB-Shadow / Random は探索コストを払う。
研究: Observation-Driven Routing for Distributed Heterogeneous Language Models (Zenodo 10.5281/zenodo.21755612)。MIT License — ArcAsha (Akasha-OS).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file arcasha_router-0.1.0.tar.gz.
File metadata
- Download URL: arcasha_router-0.1.0.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
323491904423e1f2870f121bf39e32745c1810985db8ae4ff2617b933f4068db
|
|
| MD5 |
c0870546b36f79c3fad73b600a9bf506
|
|
| BLAKE2b-256 |
b08cf3aef10e757ca6dc8b1817d10ad1e18650785763a928c004f9ae0ea024d5
|
File details
Details for the file arcasha_router-0.1.0-py3-none-any.whl.
File metadata
- Download URL: arcasha_router-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f1f7e1c45bbf55bf66b1716ba6d7c19d5fef6dfca7de8c3e0b6fce1fb8703a1
|
|
| MD5 |
00e23ff38ef516038bbce8c9811d9f8a
|
|
| BLAKE2b-256 |
12c28241837d9049db5857f19f8a2fe2d7c2b7908658c02e27954630ebaf1f5c
|