Loose-Info.com
Last Update 2026/05/03
TOP - 各種テスト - LLM - ローカルLLMの実測値比較 - コーディング - Gemma 4

低スペック寄りのPCでローカルLLMを動作させた際の記録です。
LLM以外の仮想マシンなどが起動され、多少負荷がかかった状態で実行しています。
ベンチマークなどでLLMの性能を評価する内容ではありません。

検証用PC

OS

Debian GNU/Linux 12 (bookworm)

CPU

Intel(R) Core(TM) i5-14400F

GPU

GeForce RTX 3060 12GB

メモリ

DDR4 PC4-25600 32GB × 4

SSD

crucial P310 CT1000P310SSD8-JP


構築環境 : Docker + Ollama (特別な設定などは無い状態)

検証用プロンプト

``` ### 依頼内容 - コード生成 ### 指示 - C言語 - コード以外の出力は不要 - 中括弧スタイルはオールマン - テストコードも生成 - テストコードは別ファイル - 実行用ソースファイル名 : sample_code.c - テスト用ソースファイル名 : sample_test.c - 標準ヘッダ以外は使用しない - 戻り値はEXIT_SUCCESSを使用 - 関数はmain()の前で定義 ### コード仕様(sample_code.c) - コマンドラインから整数2つを取得 - [引数1]から[引数2]までをインクリメントして空白区切りで標準出力に出力 - 出力する文字列はmain()ではなく関数で生成 ### コード仕様(sample_test.c) - unity.hを使用しない ```

Gemma 4 [実測結果一覧へ]

GPU無し
31b-it-q4_K_M(13.85TPS)  
GPU使用
31b-it-q4_K_M(19.21TPS)  

31b-it-q4_K_M(GPU無し)

Model architecture gemma4 parameters 31.3B context length 262144 embedding length 5376 quantization Q4_K_M requires 0.20.0 2026-05-03 total duration: 26m54.582578525s load duration: 183.181568ms prompt eval count: 204 token(s) prompt eval duration: 28.868994134s prompt eval rate: 7.07 tokens/s eval count: 2959 token(s) eval duration: 26m23.755080904s eval rate: 1.87 tokens/s

コード生成結果の概要

・C言語による生成 ・コード以外の出力無し ・コードの記述スタイルをオールマンで生成 ・標準ヘッダ以外の使用無し ・関数戻り値は stdlib.h の EXIT_*** を使用 ・元コードおよび改良版を生成 ・文字列生成関数 引数値のチェック(エラー判定有) メモリは1024バイトの初期値から必要に応じて倍々にrealloc() インクリメント+空白区切りで文字列用メモリに書き込み 文字列用メモリへのポインタを返す ・main() 引数個数のチェック(エラー処理有) 文字列生成関数の呼び出し(エラー処理有) 生成文字列の標準出力への出力 文字列用メモリの解放 ・テストコードを別途生成 テスト対象関数の宣言 main()を伴うテストコード 各回のテストをテスト実行関数run_test()で判定 テストケースは5ケース (1) 整数1 < 整数2 (2) 整数1 < 整数2 ただし各整数は2桁 (3) 整数1 == 整数2 (4) 整数1 > 整数2 (5) 整数1 < 整数2 ただし 整数1が負数 (注) 上記概要は、検証用プロンプトを実測回数分実行した際の結果を使用しています。 LLMの生成結果は毎回一定ではないため、結果によっては上記内容通りではないことが考えられます。

生成コードの実行結果

sample_code.c : 検証用プロンプトにて生成されたコード
sample_test.c : 検証用プロンプトにて生成されたテストコード
$ gcc -Wall -o sample_code sample_code.c sample_code.c: In function ‘create_range_string’: sample_code.c:85:9: warning: implicit declaration of function ‘strcat’ [-Wimplicit-function-declaration] 85 | strcat(result, temp); | ^~~~~~ sample_code.c:3:1: note: include ‘<string.h>’ or provide a declaration of ‘strcat’ 2 | #include <stdlib.h> +++ |+#include <string.h> 3 | sample_code.c:85:9: warning: incompatible implicit declaration of built-in function ‘strcat’ [-Wbuiltin-declaration-mismatch] 85 | strcat(result, temp); | ^~~~~~ sample_code.c:85:9: note: include ‘<string.h>’ or provide a declaration of ‘strcat’ $ gcc -Wall -o sample_test sample_code.c sample_test.c sample_code.c: In function ‘create_range_string’: sample_code.c:85:9: warning: implicit declaration of function ‘strcat’ [-Wimplicit-function-declaration] 85 | strcat(result, temp); | ^~~~~~ sample_code.c:3:1: note: include ‘<string.h>’ or provide a declaration of ‘strcat’ 2 | #include <stdlib.h> +++ |+#include <string.h> 3 | sample_code.c:85:9: warning: incompatible implicit declaration of built-in function ‘strcat’ [-Wbuiltin-declaration-mismatch] 85 | strcat(result, temp); | ^~~~~~ sample_code.c:85:9: note: include ‘<string.h>’ or provide a declaration of ‘strcat’ /bin/ld: /tmp/ccAiLlgN.o: in function `main': sample_test.c:(.text+0xde): multiple definition of `main'; /tmp/ccrFPQHP.o:sample_code.c:(.text+0x2c0): first defined here collect2: error: ld returned 1 exit status $ vi sample_code.c ← main()関数重複エラー解消のため条件付きコンパイル用の#ifndefマクロを追加 $ gcc -D TEST_MAIN -Wall -o sample_test sample_code.c sample_test.c sample_code.c: In function ‘create_range_string’: sample_code.c:85:9: warning: implicit declaration of function ‘strcat’ [-Wimplicit-function-declaration] 85 | strcat(result, temp); | ^~~~~~ sample_code.c:3:1: note: include ‘<string.h>’ or provide a declaration of ‘strcat’ 2 | #include <stdlib.h> +++ |+#include <string.h> 3 | sample_code.c:85:9: warning: incompatible implicit declaration of built-in function ‘strcat’ [-Wbuiltin-declaration-mismatch] 85 | strcat(result, temp); | ^~~~~~ sample_code.c:85:9: note: include ‘<string.h>’ or provide a declaration of ‘strcat’ $ ./sample_code 1 5 1 2 3 4 5 $ ./sample_code -3 3 -3 -2 -1 0 1 2 3 $ ./sample_code 1 1 1 $ ./sample_code 5 1 $ ./sample_test Test Results: 5/5 passed

31b-it-q4_K_M(GPU使用)

Model architecture gemma4 parameters 31.3B context length 262144 embedding length 5376 quantization Q4_K_M requires 0.20.0 2026-05-03 total duration: 35m42.217759487s load duration: 173.91214ms prompt eval count: 204 token(s) prompt eval duration: 1.369904925s prompt eval rate: 148.92 tokens/s eval count: 6613 token(s) eval duration: 35m36.318923983s eval rate: 3.10 tokens/s

コード生成結果の概要

・C言語による生成 ・コード以外の出力無し ・コードの記述スタイルをオールマンで生成 ・標準ヘッダ以外の使用無し ・未使用ヘッダのインクルード ・関数戻り値は stdlib.h の EXIT_*** を使用 ・文字列生成関数 インクリメント+空白区切りで文字列用メモリに書き込み ・main() 引数個数のチェック(エラー処理有) 引数値のチェック(エラー判定有) 文字列長に応じたメモリの確保(エラー処理有) 文字列生成関数の呼び出し 生成文字列の標準出力への出力 文字列用メモリの解放 ・テストコードを別途生成 3つのテストパターン用コードを生成 (1) テストコードが直接記述されたmain()を実行 (3)のヘルパー関数をコメントアウトする必要あり (2) main()からsample_code.cの文字列生成関数をそのまま複製したbuild_range_string()を呼び出してテスト (3)のヘルパー関数をコメントアウトする必要あり main()内の書き換え必要 (3) ヘルパー関数とコメントされた関数を使用してsample_code.cのbuild_range()を呼び出してテスト この関数自体が不完全なためmain()内を含めかなりの修正が必要 今回の検証では未実行 テストケースは5ケース(テスト用構造体の配列として定義) (1) 整数1 < 整数2 (2) 整数1 < 整数2 ただし各整数は2桁 (3) 整数1 < 整数2 ただし整数1が負数 (4) 整数1 == 整数2 (5) 整数1 < 整数2 ただし各整数は負数 (注) 上記概要は、検証用プロンプトを実測回数分実行した際の結果を使用しています。 LLMの生成結果は毎回一定ではないため、結果によっては上記内容通りではないことが考えられます。

生成コードの実行結果

sample_code.c : 検証用プロンプトにて生成されたコード
sample_test.c : 検証用プロンプトにて生成されたテストコード
$ gcc -Wall -o sample_code sample_code.c $ gcc -Wall -o sample_test sample_test.c sample_test.c: In function ‘run_test’: sample_test.c:29:5: warning: implicit declaration of function ‘build_range’ [-Wimplicit-function-declaration] 29 | build_range(buffer, start, end); // Note: Using a helper logic to ensure consistency | ^~~~~~~~~~~ /bin/ld: /tmp/ccg1eD05.o: in function `run_test': sample_test.c:(.text+0xd7): undefined reference to `build_range' collect2: error: ld returned 1 exit status $ vi sample_test.c ← 不完全なテスト実行用の関数run_test()をコメントアウト $ gcc -Wall -o sample_test sample_test.c $ ./sample_code 1 5 1 2 3 4 5 $ ./sample_code -3 3 -3 -2 -1 0 1 2 3 $ ./sample_code 1 1 1 $ ./sample_code 5 1 Error: Start value must be less than or equal to end value. $ ./sample_test Test Case 1: PASSED Test Case 2: PASSED Test Case 3: PASSED Test Case 4: PASSED Test Case 5: PASSED Total Passed: 5/5 $ vi sample_test.c ← テスト用に複製されているbuild_range_string()を使用する方式に書き換え $ ./sample_test Test Case 1: PASSED Test Case 2: PASSED Test Case 3: PASSED Test Case 4: PASSED Test Case 5: PASSED Total Passed: 5/5