Scribble at 2026-04-22 10:04:57 Last modified: 2026-04-22 10:57:53
Gemma 4 E4B-IT Q4 (GGUF) + llama.cpp + PHP + GuzzleHttp という組み合わせでプロンプトを生成する「システム・プロンプト」を調整しているのだが、どうも結果が思わしくない。Gemini に言わせれば、僕が与えているシステム・プロンプトは Gemma 4 E4B-IT には荷が重いらしく、やはり Qwen 3.5 9B を使う方がいいんじゃないかという話だ。実際、上のスクリーンショットでわかるように、意味不明な改行、推論プロセスの露出(当然だがシステム・プロンプトで抑制してはいる)、あるいは Marktown 式のマークアップを混在させたり(これはもともと Google の生成 AI が他のサービスでもよくやるミスだが)、果ては応答しない場合すらある(コンテクスト・ウィンドウは十分に大きくとってある)。
もともと、このシステム・プロンプトは FLUX.2 Klein で画像を生成するための自然文をプロンプトとして生成するように、Qwen 3.5 が扱えるように書いていたものなので、Gemma 4 を新しいモデルとして使うのであれば、最初から設計をやり直した方がいいのかもしれない。ただ、モデルのキャパシティとして 200 words ていどの自然文のプロンプトを組み立てる能力が不足しているのであれば、モデルを変更するしかないのだろう。Gemma 4 は軽いんだけど、生成 AI において「軽さ」とは処理性能の低さと殆ど同義だからだ。
ということで、モデルを Qwen 3.5 9B (Q4_K_M) に変更してみたのだが、プロンプトの生成に長い時間がかかる。もう10分ほどスクリプトが動いているので、タイムアウトまでに終わることを願っているのだが、これは明らかに推論モードに入ってしまっているから、これを抑制しないといけない。
なので、いったん中断して調べてみると、llama.cpp は推論モードを有効にしてモデルを読み込むため、これをサーバの起動時に抑制するスイッチはないというから、最初から推論モードをもっていないモデルを選ぶのがよさそうだ。Qwen 3.5 だと、Unsloth AI というサービスを運営している会社がファイン・チューニングしたモデルを選ぶ人が多く、その理由の一つが推論モードを有効にしていない高速なモデルだからだという。そこで、Unsloth AI がファイン・チューンしたモデルを更に量子化してリリースしている、nexus-flash-9B.Q8_0.gguf というモデル(これでもファイル・サイズは 9 GB ほどあるが)を使ってみた。確かに速い。速いのだが、レスポンスの品質があまりにも悪すぎる。
, A lone figure stands on a cliff edge, A lone figure stands on a cliff edge, A lone figure stands on a cliff edge, A lone figure stands on a cliff edge, A lone figure stands on a cliff edge, A lone figure stands on a cliff edge, A lone figure stands on a cliff edge, A lone figure stands on a cliff edge, A lone figure stands on a cliff edge, A lone figure stands on a cliff edge, A lone figure stands on a cliff edge, A lone figure stands on a cliff edge, A lone figure stands on a cliff edge, A lone figure stands on a cliff edge, A lone figure stands on a cliff edge, A lone figure stands on a cliff edge, A lone figure stands on a cliff edge, A lone figure stands on a cliff edge, A lone figure stands on a cliff edge, A lone figure stands on a cliff edge, A lone figure stands on a cliff edge, A lone figure stands on a cliff edge, A lone figure stands on a cliff edge, A lone figure stands on a cliff edge, A lone figure stands on a cliff edge, A lone figure stands on a cliff edge, A lone figure stands on a cliff edge, A lone figure stands on a cliff edge, A lone figure stands on a cliff edge, A lone figure stands on a cliff edge, A lone figure stands on a cliff edge, A lone figure stands on a cliff edge, A lone figure stands on a cliff edge, A lone...
こんなんでは使えない。