Last Update 2026/04/21
低スペック寄りのPCでローカルLLMを動作させた際の記録です。
LLM以外の仮想マシンなどが起動され、多少負荷がかかった状態で実行しています。
ベンチマークなどで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言語
- コード以外の出力は不要
- 中括弧スタイルはオールマン
- テストコードを別途生成
### コード仕様
- コマンドラインから整数2つを取得
- [引数1]から[引数2]までをインクリメントして空白区切りで標準出力に出力するコード
- 文字列はmain()ではなく関数で生成
- 戻り値はEXIT_SUCCESSを使用
```
Phi-4 [実測結果一覧へ]
GPU無し
14b-q4_K_M(4.52TPS)
GPU使用
14b-q4_K_M(35.32TPS)
コード生成結果の概要
・C言語による生成
・コード以外の出力無し
・コードの記述スタイルのオールマン指定を無視
・文字列生成関数
文字列生成ではなく出力
・main()
引数個数のチェック(エラー処理有)
関数の呼び出し
・テストコードを別途生成
main()を伴うテストコード
テスト方式が実測1回目と2回目で異なる
1回目
dup()、dup2()を利用して、標準出力のリダイレクトによるファイル出力を利用したテスト
2回目
標準出力に出力されたテストケースの実行結果を目視で確認
・関数戻り値は stdlib.h の EXIT_*** を使用
(注) 上記概要は、検証用プロンプトを実測回数分実行した際の結果を使用しています。
LLMの生成結果は毎回一定ではないため、結果によっては上記内容通りではないことが考えられます。
生成コードの実行結果
sample_code_a.c : 実測1回目(GPU無し)に検証用プロンプトにて生成されたコードsample_test_a.c : 実測1回目(GPU無し)に生成されたテストコード
sample_code_b.c : 実測2回目(GPU使用)に検証用プロンプトにて生成されたコード
sample_test_b.c : 実測2回目(GPU使用)に生成されたテストコード
(注)
テストコードには生成コード内の文字列生成関数を追記
$ gcc -Wall -o sample_code_a sample_code_a.c
$ gcc -Wall -o sample_test_a sample_test_a.c
sample_test_a.c: In function ‘testPrintRange’:
sample_test_a.c:13:24: warning: implicit declaration of function ‘dup’ [-Wimplicit-function-declaration]
13 | int saved_stdout = dup(fileno(stdout));
| ^~~
sample_test_a.c:14:5: warning: implicit declaration of function ‘dup2’ [-Wimplicit-function-declaration]
14 | dup2(fileno(fp), fileno(stdout));
| ^~~~
sample_test_a.c:23:5: warning: implicit declaration of function ‘close’; did you mean ‘pclose’? [-Wimplicit-function-declaration]
23 | close(saved_stdout);
| ^~~~~
| pclose
sample_test_a.c:33:9: warning: implicit declaration of function ‘strcmp’ [-Wimplicit-function-declaration]
33 | if (strcmp(expected_output, actual_output) == 0) {
| ^~~~~~
sample_test_a.c:3:1: note: include ‘<string.h>’ or provide a declaration of ‘strcmp’
2 | #include <stdlib.h>
+++ |+#include <string.h>
3 |
$ gcc -Wall -o sample_code_b sample_code_b.c
$ gcc -Wall -o sample_test_b sample_test_b.c
$ ./sample_code_a 1 5
1 2 3 4 5
$ ./sample_code_a -3 3
-3 -2 -1 0 1 2 3
$ ./sample_code_a 1 1
1
$ ./sample_code_a 5 1
$ ./sample_test_a
1 2 3 4 5
Test failed. Expected: 1 2 3 4 5
, but got: ← テスト失敗
$ ./sample_code_b 1 5
1 2 3 4 5
$ ./sample_code_b -3 3
-3 -2 -1 0 1 2 3
$ ./sample_code_b 1 1
1
$ ./sample_code_b 5 1
$ ./sample_test_b
Test Case: Start = 3, End = 7
3 4 5 6 7
Test Case: Start = 10, End = 12
10 11 12
Test Case: Start = -5, End = 5
-5 -4 -3 -2 -1 0 1 2 3 4 5
【実測2回目(GPU使用) テストコード修正後】 ファイル書き込み時にバッファフラッシュ「fflush(stdout)」を追加
$ gcc -Wall -o sample_test_a sample_test_a.c
sample_test_a.c: In function ‘testPrintRange’:
sample_test_a.c:13:24: warning: implicit declaration of function ‘dup’ [-Wimplicit-function-declaration]
13 | int saved_stdout = dup(fileno(stdout));
| ^~~
sample_test_a.c:14:5: warning: implicit declaration of function ‘dup2’ [-Wimplicit-function-declaration]
14 | dup2(fileno(fp), fileno(stdout));
| ^~~~
sample_test_a.c:24:5: warning: implicit declaration of function ‘close’; did you mean ‘pclose’? [-Wimplicit-function-declaration]
24 | close(saved_stdout);
| ^~~~~
| pclose
sample_test_a.c:34:9: warning: implicit declaration of function ‘strcmp’ [-Wimplicit-function-declaration]
34 | if (strcmp(expected_output, actual_output) == 0) {
| ^~~~~~
sample_test_a.c:3:1: note: include ‘<string.h>’ or provide a declaration of ‘strcmp’
2 | #include <stdlib.h>
+++ |+#include <string.h>
3 |
$ ./sample_test_a
Test passed.
14b-q4_K_M(GPU無し)
Model
architecture phi3
parameters 14.7B
context length 16384
embedding length 5120
quantization Q4_K_M
2026-04-20
total duration: 1m33.918656121s
load duration: 75.577741ms
prompt eval count: 174 token(s)
prompt eval duration: 11.807289195s
prompt eval rate: 14.74 tokens/s
eval count: 370 token(s)
eval duration: 1m21.811824182s
eval rate: 4.52 tokens/s
14b-q4_K_M(GPU使用)
Model
architecture phi3
parameters 14.7B
context length 16384
embedding length 5120
quantization Q4_K_M
2026-04-20
total duration: 15.132020755s
load duration: 52.813287ms
prompt eval count: 174 token(s)
prompt eval duration: 177.650863ms
prompt eval rate: 979.45 tokens/s
eval count: 517 token(s)
eval duration: 14.637202332s
eval rate: 35.32 tokens/s