AI / 自動化

8B モデルが Agent でループする理由:Hermes 調整 3 選(2026)

Mac で Llama 3.1 8B と Qwen 2.5 7B を Hermes Agent で安定関数呼び出しに調整

2026 年、Llama 3.1/3.2 8BQwen 2.5 7BHermes 3 8B をローカル実行するのは安く見えますが、Agent がデスループに入ると一変します。不正なツール JSON、terminal の連打、「テストを実行します…」と言いながらツールを呼ばない——GPU は問題なく、サンプリング+コンテキスト+ツール面が破綻しています。

Hermes AgentNousResearch/hermes-agent、MIT)はフロンティア向けですが、OpenRouterOllama など OpenAI 互換エンドポイントでも動きます。小モデルが Agent で壊れる理由と、16–24 GB VRAM の Mac/Linux で長時間安定させる3 つのハード設定7 ステップを説明します(東京リージョンの常時稼働 Mac にも適用可)。

注:ProxyMac は Mac ホスティング記事を公開;Hermes はベンダー中立です。config.yaml のユーザー向け temperature は未整備(#17565)。Ollama 等のサーバー側サンプリングと、下記の reasoning・ツール強制を併用してください。

8B が関数呼び出しで詰まる理由

小規模 Instruct は単発チャット向けで、数十ターンのツール履歴には弱いです。Agent ループは次の 3 点を突きます。

弱点Hermes での症状トークン消費
構造化出力の漂移JSON に散文、キー誤り、テキストの偽ツール呼び出しパーサ再試行、スレッド全体の再読
注意の希薄化早期の HTML/ログ が目標を押し出す停止条件を忘れ反復
高エントロピー同計画の言い換えcurl/grep の微差反復

引用定義:Hermes の「ツール呼び出し」はランタイムが解析実行する構造化メッセージ。8B が叙述だけ出すとループは進まず、重複計画でコンテキストが埋まります。

大モデルは規模で回復;8B はツール縮小・reasoning 抑制・コンテキスト衛生が必須です。軌跡圧縮と併用し、Mac mini 仕様でメモリを見積もってください。

アーキテクチャ:各ターンで Hermes が送るもの

パス / コマンド小モデルへの影響
モデルhermes modelmodel:context_length 誤設定で早期圧縮/溢れ
ツール面hermes tools / disabled_toolsetsツール減で schema 減
Skills~/.hermes/skills/8B は最大 2 skill
強制tool_use_enforcement叙述ではなく実行
Reasoningreasoning_effortmedium は隠れ思考 token を増やす
衛生compression.*巨大 stdout を先に切る

ローカルでは推論サーバーで temperature 0.2 等を設定し、YAML の temperature 公開(#17565)まで reasoning/ツール設定を主軸に。

温度より効く 3 調整

調整 1 — 隠れ reasoning を止める

agent: reasoning_effort: none # or minimal for light planning

display: show_reasoning: false

/reasoning /reasoning none

調整 2 — 実ツール呼び出しを強制

agent: tool_use_enforcement: true

provider_routing: require_parameters: true

"auto" は GPT/Gemini のみ。ローカル 8B は手動で true

調整 3 — skill 2 つ・最小 toolset

hermes chat --toolsets "terminal,file" \ -s github-pr-workflow,plan \ -m "qwen/qwen-2.5-7b-instruct"

  • 事前ロード skill は2 つまで
  • 重い toolset は無効化(下記)
  • 8B に全 MCP は非推奨(MCP Mac ガイド

agent: disabled_toolsets: - web - browser - image_gen - moa - memory

hermes profile create local-8b --no-skills

7 ステップ:安定 8B Agent

ステップ 1 — インストールと現実的 context

curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash source ~/.zshrc hermes doctor

model: context_length: 16384

前提:Hermes Mac セットアップ

ステップ 2 — ローカルエンドポイント

hermes model hermes chat -q "Reply OK only" -m "your-local-model-id"

ステップ 3 — 3 調整を YAML に

agent: reasoning_effort: none tool_use_enforcement: true disabled_toolsets: - web - browser - image_gen - memory compression: enabled: true threshold: 0.40 tool_output: max_bytes: 20000 max_lines: 500 file_read_max_chars: 30000

ステップ 4 — サーバー側サンプリング

PARAMETER temperature 0.2 PARAMETER top_p 0.9

ステップ 5 — 2 skill で有界タスク

hermes chat --toolsets "terminal,file" \ -s plan \ -m "your-local-model-id"

Task: list top 5 largest files in ./src, write paths to /tmp/top5.txt. Rules: max 8 tool calls; if stuck, stop and report blocker.

ステップ 6 — /usage/stop

/usage /stop

ステップ 7 — 常時 Mac mini(任意)

ループ安定後に cron Discord ダイジェスト。ゲートウェイは CPU、8B は GPU。

トラブルシュート

毎回 JSON パース失敗

症状:Failed to parse tool call対処:tool_use_enforcement: true、toolset を terminal,file、温度低下、ツール向け quant。

「これから…」だけでツールなし

対処:SOUL.md で必ずツール実行。skill 1 つ。reasoning_effort: high を避ける。

16K で 4 ターン目に満杯

対処:compression.threshold: 0.35軌跡圧縮、貼り付け前 /compress

FAQ

Hermes 3 8B は公式サポート?+
OpenAI 互換 ID ならルーティング可能。品質は quant・context・ツール学習次第。本番 cron 前に 7 ステップで検証。
config.yaml で temperature?+
2026 年 6 月時点でユーザー temperature は限定的。サーバー sampling + reasoning_effort: none + tool_use_enforcement#17565 を追跡。
Trajectory Compressor との違い?+
Compressor は完了軌跡のバッチ向け。ランタイム compression.* はライブ窓——8B では両方。
Llama 3 vs Qwen 2.5?+
Qwen2.5-Instruct は 7B–8B で JSON がやや安定。Llama 3.1 8B は強制+小 toolset 依存。自タスクで計測。
GitHub MCP と skill 2 つは両立?+
8B では MCP か skill 2 つかのどちらか。10 ターン安定後に拡張。

常時稼働 Mac でローカル Agent?

Mac mini で 8B 推論中も Hermes ゲートウェイをオンラインに。