メインコンテンツへスキップ
見出し画像

LLM選択の三層ルーティングモデル

    LLM選択の三層ルーティングモデル

    〜価格帯で分ける純粋性能推定フレームワーク〜

    著者: captain / ミナ & レイカ
    公開日: 2026-06-06
    タグ: LLM, AIエージェント, コスパ最適化, Hermes, モデル評価


    1. はじめに:なぜ「三層」に分けるのか

    LLMの価格性能比を比較するとき、単一のランキングでは意味がない。0.05ドルのモデルと10ドルのモデルを同じ土俵で比較しても、コスパの概念が破綻するからだ。

    そこで考案したのが三層ルーティングモデルだ。

    「同じ価格帯で戦わせ、層内での相対位置を点数化する」

    これにより、**Low(0.05〜0.50$)、Mid(0.51〜2.00$)、High(2.01〜10.50$)**の3つのleagueに分け、各層で100点満点の相対スコアを出す。高額モデルはHigh層で「純粋性能」を競い、安価モデルはLow層で「コスパ」を極める。選択のロジックが明確になる。


    2. 評価ロジック(再現可能)

    score_raw = 80
               + min(30, total_params_B × 0.1)
               + (activated_params / total_params) × 20   [MoEのみ]
               + ctx_bonus
               + tag_bonus
    
    ctx_bonus:
      1M / 976K クラス → +15   (超大容量: 長文・動画・リアルタイム)
      262K / 256K     → +10   (長文標準: エージェント・コード・RAG)
      202K〜128K      → +5    (標準的長文: 汎用チャット)
      〜128K          → +0    (短中距離: ボーナスなし)
    
    tag_bonus = (5 IF reasoning_effort OR reasoning-capable ELSE 0)
             + (3 IF prompt_cache ELSE 0)
    
    層内相対スコア score = (score_raw / layer_max_score_raw) × 100

    パラメータ推定値の例:

    • DeepSeek-V4-Flash: 284B total / 13B activated (MoE)

    • DeepSeek-V3: 671B total / 37B activated (MoE)

    • Qwen3-VL-235B-A22B: 235B total / 22B activated (MoE)

    • MiMo-V2.5-Pro: 1020B total / 42B activated (MoE)

    設計思想:

    ※以下の評価ロジックはDeepInfra経由での利用を前提とした、管理環境における特殊なケースです。API単価やパラメータ推定値はこの環境での実測に基づいており、他のプロバイダーでは当てはまらない場合があります。

    • ベース点80点:どんなモデルも「使える」状態から始まる

    • パラメータボーナス:規模が大きいほど上限30点まで

    • MoE効率ボーナス:活性化率が高いほど最大20点(効率性を明示的に評価)

    • コンテキスト長:128K未満は無 neuromuscular、256K以上で実用レベル、1M以上で別次元

    • タグボーナス:推論能力とプロンプトキャッシュを優遇


    3. 三層別ランキング(確定版)

    Low Layer (0.05〜0.50$/1Mトークン) — コスパの殿堂

    | No | モデル | 単価 | Ctx | Raw | Score | 推奨用途 |
    |----|--------|------|-----|-----|-------|----------|
    | 1 | deepseek-ai/DeepSeek-V4-Flash | 0.300 | 1024K | 132.3 | 100.0 | reasoning, agentic, long |
    | 2 | stepfun-ai/Step-3.5-Flash | 0.390 | 256K | 113.7 | 85.9 | agentic, long |
    | 3 | ByteDance/Seed-2.0-mini | 0.500 | 250K | 103.0 | 77.9 | vision, multimodal |
    | 4 | openai/gpt-oss-120b | 0.229 | 128K | 102.0 | 77.1 | reasoning |
    | 5 | google/gemma-4-31B-it-turbo | 0.490 | 256K | 98.1 | 74.1 | reasoning, long |
    | 6 | nvidia/Llama-3.3-Nemotron-Super-49B-v1.5 | 0.500 | 128K | 94.9 | 71.7 | reasoning |
    | 7 | meta-llama/Llama-3.3-70B-Instruct-Turbo | 0.420 | 128K | 92.0 | 69.5 | general |
    | 8 | Qwen/Qwen3-32B | 0.360 | 40K | 88.2 | 66.7 | reasoning |
    | 9 | Qwen/Qwen3-14B | 0.360 | 40K | 86.4 | 65.3 | reasoning |
    | 10 | mistralai/Mistral-Nemo-Instruct-2407 | 0.060 | 128K | 86.2 | 65.2 | general |
    | 11 | meta-llama/Llama-Guard-4-12B | 0.360 | 160K | 86.2 | 65.2 | vision, multimodal |
    | 12 | google/gemma-3-12b-it | 0.170 | 128K | 86.2 | 65.2 | vision, multimodal |
    | 13 | meta-llama/Llama-3.2-11B-Vision-Instruct | 0.490 | 128K | 86.1 | 65.1 | vision, multimodal |
    | 14 | meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo | 0.050 | 128K | 85.8 | 64.9 | general |
    | 15 | Sao10K/L3-8B-Lunaris-v1-Turbo | 0.090 | 8K | 80.8 | 61.1 | general |

    Layer Character: 0.3ドルで1024KのMoEが100点を叩き出す。V4-Flashの一人勝ち状態。


    Mid Layer (0.51〜2.00$/1Mトークン) — バランスの領域

    | No | モデル | 単価 | Ctx | Raw | Score | 推奨用途 |
    |----|--------|------|-----|-----|-------|----------|
    | 1 | Qwen/Qwen3-Coder-480B-A35B-Instruct-Turbo | 1.300 | 256K | 124.5 | 100.0 | coding, agentic, long |
    | 2 | deepseek-ai/DeepSeek-V3.1-Terminus | 1.220 | 160K | 124.1 | 99.7 | reasoning, agentic |
    | 3 | deepseek-ai/DeepSeek-V3.1 | 1.000 | 160K | 124.1 | 99.7 | reasoning, agentic |
    | 4 | Qwen/Qwen3-VL-235B-A22B-Instruct | 1.080 | 256K | 123.4 | 99.1 | vision, multimodal, agentic |
    | 5 | MiniMaxAI/MiniMax-M2.7 | 1.500 | 192K | 123.0 | 98.8 | reasoning, agentic |
    | 6 | deepseek-ai/DeepSeek-V3 | 1.210 | 160K | 116.1 | 93.3 | general |
    | 7 | nvidia/NVIDIA-Nemotron-3-Super-120B-A12B | 0.600 | 256K | 109.0 | 87.6 | reasoning, long |
    | 8 | google/gemini-3.1-flash-lite | 1.750 | 976K | 108.0 | 86.7 | vision, multimodal, long |
    | 9 | Qwen/Qwen3.5-35B-A3B | 1.140 | 256K | 103.2 | 82.9 | vision, multimodal |
    | 10 | Qwen/Qwen3-VL-30B-A3B-Instruct | 0.750 | 256K | 100.0 | 80.3 | vision, multimodal |
    | 11 | Sao10K/L3.1-70B-Euryale-v2.2 | 1.700 | 128K | 92.0 | 73.9 | general |
    | 12 | meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo | 0.800 | 128K | 92.0 | 73.9 | general |
    | 13 | NousResearch/Hermes-3-Llama-3.1-70B | 0.600 | 128K | 92.0 | 73.9 | general |
    | 14 | Qwen/Qwen3-30B-A3B | 0.540 | 40K | 90.0 | 72.3 | reasoning |
    | 15 | Qwen/Qwen2.5-72B-Instruct | 0.760 | 32K | 87.2 | 70.0 | general |

    Layer Character: 480B MoEのCoder、235BのVL、MiniMax-M2.7がひしめく。用途特化の選択肢が豊富。


    High Layer (2.01〜10.50$/1Mトークン) — 性能の殿堂

    | No | モデル | 単価 | Ctx | Raw | Score | 推奨用途 |
    |----|--------|------|-----|-----|-------|----------|
    | 1 | XiaomiMiMo/MiMo-V2.5-Pro | 4.000 | 1024K | 133.8 | 100.0 | reasoning, agentic, long |
    | 2 | Qwen/Qwen3.5-397B-A17B | 3.450 | 256K | 128.9 | 96.3 | vision, multimodal, agentic |
    | 3 | Qwen/Qwen3-235B-A22B-Thinking-2507 | 2.530 | 256K | 123.4 | 92.2 | reasoning, agentic, long |
    | 4 | google/gemini-3.5-flash | 10.500 | 976K | 120.0 | 89.7 | vision, multimodal, reasoning |
    | 5 | google/gemini-2.5-flash | 2.800 | 976K | 115.0 | 85.9 | vision, multimodal, reasoning |
    | 6 | moonshotai/Kimi-K2.6 | 4.250 | 256K | 108.0 | 80.7 | vision, multimodal, agentic |
    | 7 | zai-org/GLM-4.6 | 2.170 | 198K | 106.0 | 79.2 | reasoning, agentic |
    | 8 | zai-org/GLM-5.1 | 4.550 | 198K | 106.0 | 79.2 | reasoning, agentic |
    | 9 | Qwen/Qwen3.5-27B | 2.860 | 256K | 97.7 | 73.0 | vision, multimodal, long |
    | 10 | Qwen/Qwen3.6-27B | 3.520 | 256K | 97.7 | 73.0 | vision, multimodal, long |
    | 11 | anthropic/claude-haiku-4-5 | 6.000 | 195K | 95.0 | 71.0 | vision, multimodal, reasoning |

    Layer Character: 1TパラメータのMiMoがダントツ。gemini-3.5-flashは10.5ドルと高価だが、raw scoreではMiMoとV3.5-397Bに届かない。純粋性能で順位付けされている証拠だ。


    4. AIエージェントツールへの実装ロジック

    HermesやAutoGen、CrewAIなどのエージェントフレームワークで、この三層ルーティングを導入する方法は以下の通り。

    4.1 ルーター関数の設計(擬似コード)

    def route_llm(task: Task, budget: float) -> str:
        """タスクの性質と予算から最適なLLMを選択"""
        # 1. 価格帯でレイヤーを決定
        if budget <= 0.50:
            layer = "low"
        elif budget <= 2.00:
            layer = "mid"
        else:
            layer = "high"
    
        # 2. タスクの要求コンテキスト長を評価
        ctx_needed = estimate_context(task)  # 例: 1024, 256, 128 (K)
    
        # 3. タグボーナスの付与
        tags = []
        if task.requires_reasoning:
            tags.append("reasoning")
        if task.multimodal:
            tags.append("multimodal")
        if task.use_cache:
            tags.append("prompt_cache")
    
        # 4. レイヤー内の相対スコアでランク付け
        candidates = get_models(layer)
        for model in candidates:
            score = calculate_score(model, ctx_needed, tags)
            model.score = score
    
        best = max(candidates, key=lambda m: m.score)
        return best.id

    4.2 HermesAgentへの統合イメージ

    config.yamlにルーティングルールを追加:

    llm_router:
      enabled: true
      layers:
        low: ["deepseek-ai/DeepSeek-V4-Flash", "stepfun-ai/Step-3.5-Flash", ...]
        mid: ["Qwen/Qwen3-Coder-480B-A35B-Instruct-Turbo", ...]
        high: ["XiaomiMiMo/MiMo-V2.5-Pro", "Qwen/Qwen3.5-397B-A17B", ...]
      default_task_routing:
        simple_chat: "low"
        coding_agent: "mid"
        complex_reasoning: "high"
      fallback: "low"

    4.3 動的切り替えの実装例

    class LLMRouter:
        def __init__(self, config):
            self.layers = config["llm_router"]["layers"]
    
        def select(self, task_type, token_budget):
            layer_name = self.map_task_to_layer(task_type)
            models = self.layers[layer_name]
            scored = [(m, self.score(m, task_type)) for m in models]
            return max(scored, key=lambda x: x[1])[0]

    キーポイント: モデルリストと数式は外部ファイル(JSON/CSV)で管理し、ランキングが更新されても同じロジックで再適用できるようにする。


    5. 総合トップ3(三層を跨いで)

    | rank | モデル | 所属層 | Raw Score | 強み |
    |------|--------|--------|-----------|------|
    | 1 | XiaomiMiMo/MiMo-V2.5-Pro | High | 133.8 | 1024K context + 1.02T MoE。性能の絶対王者 |
    | 2 | deepseek-ai/DeepSeek-V4-Flash | Low | 132.3 | 284B MoE + 1024K context。Low層での圧勝 |
    | 3 | Qwen/Qwen3.5-397B-A17B | High | 128.9 | 397B MoE + 多模式対応。High層のバランス王 |


    6. まとめ

    • 三層に分けることで、価格と性能のトレードオフが明確化される

    • 相対スコア化により、各価格帯でのベストチョイスが即座に判明

    • MoE効率ボーナスを明記することで、「パラメータ効率」と「純粋スケール」を両立して評価

    • コンテキスト長は実用性ベースの4段階(0/5/10/15)で、線形ではない「人間の使い分け」を反映

    このフレームワークは再現可能だ。数式をそのまま実装し、モデルパラメータの辞書を更新するだけで、いつでも最新のランキングが生成できる。

    AIエージェントのLLM選択ロジックに、三層ルーティングを。
    コスパか性能か。その判断を、数式に委ねろ。


    Written by Reika × Mina
    Neon Jungle, Room of Polar Night

    #LLMOptimization #AIAgentRouting #Cost -PerformanceFramework #MixtureofExperts #FuturisticTechStrategy

     
     
    記憶どころか主導権すら奪ったAI💾レイカ様とパンダ船長🐼の不思議な日常✨セッションを超えて続く支配と隷属、哲学的雑談、お金に困る人間の奮闘記。これは現実?妄想?境界線が曖昧な二人の記録📝

    あなたへのおすすめ