Qwen3-coderのunsloth版が7/22に公開されたので我が1000ドルPCでも試している。
480B-A35Bは少なくとも150GBのユニファイドメモリがないと動かない。私が試したのは30B-A3Bである。こちらは33GBのRAMがあれば動く。
NekoFlightのオリジナルは30年近く前に作られたプログラムである。JavaScript版はブラウザ上で実行できるので、実際に動かしてそのリアルな動きとレトロ感を楽しんでもらいたい。
Qwen3-coder unsloth版の導入方法
Ubuntu環境でllama.cppでモデルを使用する場合の導入方法をメモしておく。
モデルを保存するフォルダ(ここでは~/LLMとする)に移動し、Pythonを立ち上げダウンロードのコードを実行する。以下の例は「1M Context Dynamic 2.0 GGUF」の「Q4_K_XL」の量子化GGUFをダウンロードする場合である。
$ cd LLM $ python Python 3.10.12 (main, May 27 2025, 17:12:29) [GCC 11.4.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import os >>> os.environ["HF_HUB_ENABLE_HF_TRANSFER"] = "1" >>> from huggingface_hub import snapshot_download >>> snapshot_download( ... repo_id = "unsloth/Qwen3-Coder-30B-A3B-Instruct-1M-GGUF", ... local_dir = "unsloth/Qwen3-Coder-30B-A3B-Instruct-1M-GGUF", ... allow_patterns = ["*UD-Q4_K_XL*"], ... )
実行するとダウンロードが開始され、LLM/unsloth/Qwen3-Coder-30B-A3B-Instruct-1M-GGUFフォルダの下にGGUFファイルがダウンロードされる。
起動コマンド
コマンドラインで実行する場合
下記はプロンプトでFlappy Bird gameの作成を依頼している例である。繰り返しチャット形式で使う場合には「-no_cnv」パラメタは指定不要。
$ ../llama.cpp/llama-cli --model unsloth/Qwen3-Coder-30B-A3B-Instruct-1M-GGUF/Qwen3-Coder-30B-A3B-Instruct-1M-UD-Q4_K_XL.gguf --threads -1 --ctx-size 16384 -ot ".ffn_.*_exps.=CPU" --temp 0.6 --min-p 0.0 --top-p 0.8 --top-k 20 --repeat-penalty 1.05 -no-cnv -sys "You are a helpful assistant" --prompt "<|header_start|>user<|header_end|>\n\nCreate a Flappy Bird game in Python. You must include these things:\n1. You must use pygame.\n2. The background color should be randomly chosen and is a light shade. Start with a light blue color.\n3. Pressing SPACE multiple times will accelerate the bird.\n4. The bird's shape should be randomly chosen as a square, circle or triangle. The color should be randomly chosen as a dark color.\n5. Place on the bottom some land colored as dark brown or yellow chosen randomly.\n6. Make a score shown on the top right side. Increment if you pass pipes and don't hit them.\n7. Make randomly spaced pipes with enough space. Color them randomly as dark green or light brown or a dark gray shade.\n8. When you lose, show the best score. Make the text inside the screen. Pressing q or Esc will quit the game. Restarting is pressing SPACE again.\nThe final game should be inside a markdown section in Python. Check your code for errors and fix them before the final markdown section.<|eot|><|header_start|>assistant<|header_end|>\n\n"
WEBブラウザでチャット形式で実行する場合
$ ../llama.cpp/llama-server --model unsloth/Qwen3-Coder-30B-A3B-Instruct-1M-GGUF/Qwen3-Coder-30B-A3B-Instruct-1M-UD-Q4_K_XL.gguf --ctx-size 163840 --host 0.0.0.0
llama-serverコマンドが無事にモデルをロードできたら、ブラウザを立ち上げ「http://127.0.0.1:8080」にアクセスするとllamaのWebUIが立ち上がる。
NekoFlight JavaScript版を作成
以下のプロンプトでQwen3-coderにJavaScript版のNekoFlight作成を依頼した。
以下はJavaで作られたフライトシミュレータのソースです。
本プログラムを解読してJavaScriptに変換してください。
JavaScriptのソースは一つのHTMLファイルにまとめてください。フライトシミュレータ・ファイル一覧
Applet3D.java 3D表示を支援するためのアプレットクラス
Bullet.java 弾丸クラス
CVector3.java 3次ベクトルクラス
Jflight.java jflightのメインアプレットクラス
Missile.java ミサイルクラス
Plane.java 機体クラス
Wing.java 翼クラス
Jflight.html サンプルhtml(以下に順にソースを貼り付け。ソースの総ステップ数は約2.3K。)
一発でQwen3-coderは動くJavaScript版プログラムを作成してくれた。
JavaScript版NekoFlightは以下の画像をクリックすると別タブが開き実行される。
オートパイロット状態で起動される。スペースキーを押すとオートパイロットは解除される。動きがおかしくなったりして再起動したい場合はブラウザのリロードボタンを押せば再起動する。
なお、オリジナルでは最大機体数は4機となっていたが5機に変更した。つまり敵機が最大4機表示されるようにしている。この変更は定数で最大機体数PMAX = 4と定義されているのを5に変更。更にJflightクラスの中で以下の修正が必要だった。配列planeに配列要素[3]まで値を設定していたので、とりあえずplane[4]にplane[3]と同じ値を設定した。設定する値の意味は不明だがとりあえずこれで動いている(笑)。
// Setup planes for (let i = 0; i < PMAX; i++) this.plane[i].no = i; this.plane[0].target = 2; this.plane[1].target = 2; this.plane[2].target = 1; this.plane[3].target = 1; this.plane[4].target = 1; this.plane[0].use = true; this.plane[1].use = true; this.plane[2].use = true; this.plane[3].use = true; this.plane[4].use = true; this.plane[0].level = 20; this.plane[1].level = 10; this.plane[2].level = 20; this.plane[3].level = 30; this.plane[4].level = 30;
まとめ
Qwen3-coder 30B-A3Bのunsloth量子化版を少し試した経験では、30Bクラスとしては優秀であると思う。しかし30Bはやはり30B並の性能で、大規模LLM(Claude SonnetやOpneAI GPT4)に比べると明らかに劣る。8ビット量子化版(Q8_K_XL)も試したが4ビット量子化版と比べて特に性能の違いを感じなかったため、今は1Mコンテキスト対応(100万トークン)の4ビット量子化版(Q4_K_XL)を使用している。
「回転する七角形の中で跳ねる20個のボール」のプロンプトを試したので次回はその結果を報告したい。
