Last Update 2026/05/08
低スペック寄りの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言語
- コード以外の出力は不要
- 中括弧スタイルはオールマン
- テストコードも生成
- テストコードは別ファイル
- 実行用ソースファイル名 : sample_code.c
- テスト用ソースファイル名 : sample_test.c
- 標準ヘッダ以外は使用しない
- 戻り値はEXIT_SUCCESSを使用
- 関数はmain()の前で定義
### コード仕様(sample_code.c)
- コマンドラインから整数2つを取得
- [引数1]から[引数2]までをインクリメントして空白区切りで標準出力に出力
- 出力する文字列はmain()ではなく関数で生成
### コード仕様(sample_test.c)
- unity.hを使用しない
```
Laguna XS.2 [実測結果一覧へ]
GPU無し
q4_K_M(8.41TPS)
GPU使用
q4_K_M(19.21TPS)
q4_K_M(GPU無し)
Model
architecture laguna
parameters 33.4B
context length 131072
embedding length 2048
quantization Q4_K_M
2026-05-04
total duration: 3m18.180029569s
load duration: 65.15919ms
prompt eval count: 274 token(s)
prompt eval duration: 5.221247794s
prompt eval rate: 52.48 tokens/s
eval count: 1620 token(s)
eval duration: 3m12.59506649s
eval rate: 8.41 tokens/s
コード生成結果の概要
・C言語による生成
・コード以外の出力無し
・コードの記述スタイルをオールマンで生成
・標準ヘッダ以外の使用無し
・関数戻り値は stdlib.h の EXIT_*** を使用
・文字列生成関数
文字列生成ではなく出力
・main()
引数個数のチェック(エラー処理有)
文字列生成関数の呼び出し
・テストコードを別途生成
テスト対象関数の宣言
main()を伴うテストコード
各テストケースに個別の関数を作成
テストケースは4ケース
(1) 整数1 < 整数2
(2) 整数1 == 整数2
(3) 整数1 > 整数2
(4) 整数1 < 整数2 ただし 整数1が負数
(注) 上記概要は、検証用プロンプトを実測回数分実行した際の結果を使用しています。
LLMの生成結果は毎回一定ではないため、結果によっては上記内容通りではないことが考えられます。
生成コードの実行結果
sample_code.c : 検証用プロンプトにて生成されたコードsample_test.c : 検証用プロンプトにて生成されたテストコード
$ gcc -Wall -o sample_code sample_code.c
$ gcc -Wall -o sample_test sample_code.c sample_test.c
/bin/ld: /tmp/ccNqfb9s.o: in function `main':
sample_test.c:(.text+0x120): multiple definition of `main'; /tmp/ccondeME.o:sample_code.c:(.text+0x5a): 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 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
=== Running Tests ===
Test [1-5]: 1 2 3 4 5
Expected: 1 2 3 4 5
Test [single value]: 3
Expected: 3
Test [reverse]:
Expected: (no output)
Test [negative to positive]: -2 -1 0 1 2
Expected: -2 -1 0 1 2
=== Test Results ===
Passed: 4
Failed: 0
q4_K_M(GPU使用)
Model
architecture laguna
parameters 33.4B
context length 131072
embedding length 2048
quantization Q4_K_M
2026-05-04
total duration: 2m32.489956604s
load duration: 47.289861ms
prompt eval count: 274 token(s)
prompt eval duration: 1.141896236s
prompt eval rate: 239.95 tokens/s
eval count: 1915 token(s)
eval duration: 2m30.950942082s
eval rate: 12.69 tokens/s
コード生成結果の概要
・C言語による生成
・コード以外の出力無し
・コードの記述スタイルをオールマンで生成
・標準ヘッダ以外の使用無し
・関数戻り値は stdlib.h の EXIT_*** を使用
・文字列生成関数
文字列生成ではなく出力
・main()
引数個数のチェック(エラー処理有)
文字列生成関数の呼び出し
・テストコードを別途生成
テスト対象関数の宣言
main()を伴うテストコード
整数1 > 整数2 の場合はデクリメントにて出力
テストケースは5ケース
(1) 整数1 < 整数2
(2) 整数1 > 整数2
(3) 整数1 == 整数2
(4) 整数1 < 整数2 ただし 整数1は0
(5) 整数1 < 整数2 ただし 整数1は負数
(注) 上記概要は、検証用プロンプトを実測回数分実行した際の結果を使用しています。
LLMの生成結果は毎回一定ではないため、結果によっては上記内容通りではないことが考えられます。
生成コードの実行結果
sample_code.c : 検証用プロンプトにて生成されたコードsample_test.c : 検証用プロンプトにて生成されたテストコード
$ gcc -Wall -o sample_code sample_code.c
$ gcc -Wall -o sample_test sample_code.c sample_test.c
sample_test.c: In function ‘test_print_numbers’:
sample_test.c:25:17: warning: implicit declaration of function ‘fork’ [-Wimplicit-function-declaration]
25 | pid_t pid = fork();
| ^~~~
sample_test.c:30:9: warning: implicit declaration of function ‘close’; did you mean ‘pclose’? [-Wimplicit-function-declaration]
30 | close(pipefd[0]);
| ^~~~~
| pclose
sample_test.c:31:9: warning: implicit declaration of function ‘dup2’ [-Wimplicit-function-declaration]
31 | dup2(pipefd[1], STDOUT_FILENO);
| ^~~~
sample_test.c:31:25: error: ‘STDOUT_FILENO’ undeclared (first use in this function)
31 | dup2(pipefd[1], STDOUT_FILENO);
| ^~~~~~~~~~~~~
sample_test.c:31:25: note: each undeclared identifier is reported only once for each function it appears in
sample_test.c:44:25: warning: implicit declaration of function ‘read’; did you mean ‘fread’? [-Wimplicit-function-declaration]
44 | ssize_t bytes = read(pipefd[0], buffer, sizeof(buffer) - 1);
| ^~~~
| fread
sample_test.c:45:9: warning: implicit declaration of function ‘waitpid’ [-Wimplicit-function-declaration]
45 | waitpid(pid, NULL, 0);
| ^~~~~~~
$ vi sample_code.c ← main()関数重複エラー解消のため条件付きコンパイル用の#ifndefマクロを追加
$ vi sample_test.c ← エラー解消およびテスト成功のため以下の部分を修正
・#include <unistd.h> の追加
・パイプの初期化が抜けていたので、パイプ作成 pipe(pipefd) の追加
・タイトル文字列出力直後に fflush(stdout) でバッファフラッシュ
$ gcc -D TEST_MAIN -Wall -o sample_test sample_code.c sample_test.c
sample_test.c: In function ‘test_print_numbers’:
sample_test.c:49:9: warning: implicit declaration of function ‘waitpid’ [-Wimplicit-function-declaration]
49 | waitpid(pid, NULL, 0);
| ^~~~~~~
$ ./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
5 4 3 2 1
$ ./sample_test
Running 5 tests...
Testing: test[1]... PASSED
Testing: test[2]... PASSED
Testing: test[3]... PASSED
Testing: test[4]... PASSED
Testing: test[5]... PASSED
Results: 5/5 tests passed