Last Update 2026/04/28
低スペック寄りの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を使用しない
```
Devstral Small 2 [実測結果一覧へ]
GPU無し
24b-instruct-2512-q4_K_M(2.81TPS)
GPU使用
24b-instruct-2512-q4_K_M(7.30TPS)
24b-instruct-2512-q4_K_M(GPU無し)
Model
architecture mistral3
parameters 24.0B
context length 393216
embedding length 5120
quantization Q4_K_M
2026-04-27
total duration: 3m57.427366794s
load duration: 102.907915ms
prompt eval count: 774 token(s)
prompt eval duration: 1m33.543420345s
prompt eval rate: 8.27 tokens/s
eval count: 392 token(s)
eval duration: 2m23.578929695s
eval rate: 2.73 tokens/s
コード生成結果の概要
・C言語による生成
・コード以外の出力無し
・コードの記述スタイルのオールマン指定を無視
・関数戻り値は stdlib.h の EXIT_*** を使用
・文字列生成関数
文字列用メモリはchar配列1024バイト固定
インクリメント+空白区切りでバッファに書き込み
バッファへのポインタを返す
・main()
引数個数のチェック(エラー処理有)
開始値、終了値の比較チェック(エラー処理有)
文字列生成関数の呼び出し
生成文字列の標準出力への出力
・テストコードを別途生成
テスト対象関数の宣言
main()を伴うテストコード
文字列生成関数を3種類の引数の組み合わせの目視確認用文字列を出力
(1) 整数1 < 整数2
(2) 整数1 < 整数2 ただし 整数1が負数
(3) 整数1 == 整数2
(注) 上記概要は、検証用プロンプトを実測回数分実行した際の結果を使用しています。
LLMの生成結果は毎回一定ではないため、結果によっては上記内容通りではないことが考えられます。
生成コードの実行結果
sample_code.c : 検証用プロンプトにて生成されたコードsample_test.c : 生成されたテストコード
$ gcc -Wall -o sample_code sample_code.c
sample_code.c: In function ‘generate_incremented_string’:
sample_code.c:10:9: warning: implicit declaration of function ‘strcat’ [-Wimplicit-function-declaration]
10 | strcat(buffer, num_str);
| ^~~~~~
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:10:9: warning: incompatible implicit declaration of built-in function ‘strcat’ [-Wbuiltin-declaration-mismatch]
10 | strcat(buffer, num_str);
| ^~~~~~
sample_code.c:10: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 ‘generate_incremented_string’:
sample_code.c:10:9: warning: implicit declaration of function ‘strcat’ [-Wimplicit-function-declaration]
10 | strcat(buffer, num_str);
| ^~~~~~
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:10:9: warning: incompatible implicit declaration of built-in function ‘strcat’ [-Wbuiltin-declaration-mismatch]
10 | strcat(buffer, num_str);
| ^~~~~~
sample_code.c:10:9: note: include ‘<string.h>’ or provide a declaration of ‘strcat’
sample_test.c: In function ‘test_generate_incremented_string’:
sample_test.c:7:14: warning: implicit declaration of function ‘generate_incremented_string’; did you mean ‘test_generate_incremented_string’? [-Wimplicit-function-declaration]
7 | result = generate_incremented_string(1, 5);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
| test_generate_incremented_string
sample_test.c:7:12: warning: assignment to ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
7 | result = generate_incremented_string(1, 5);
| ^
sample_test.c:11:12: warning: assignment to ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
11 | result = generate_incremented_string(-2, 2);
| ^
sample_test.c:15:12: warning: assignment to ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
15 | result = generate_incremented_string(10, 10);
| ^
/bin/ld: /tmp/ccBElR9m.o: in function `main':
sample_test.c:(.text+0xaa): multiple definition of `main'; /tmp/ccsJFwi5.o:sample_code.c:(.text+0xaa): first defined here
collect2: error: ld returned 1 exit status
$ vi sample_code.c ← main()関数重複エラー解消のため条件付きコンパイル用の#ifndefマクロを追加
$ vi sample_test.c ← テスト対象関数の宣言を追加
$ gcc -D TEST_MAIN -Wall -o sample_test sample_code.c sample_test.c
sample_code.c: In function ‘generate_incremented_string’:
sample_code.c:10:9: warning: implicit declaration of function ‘strcat’ [-Wimplicit-function-declaration]
10 | strcat(buffer, num_str);
| ^~~~~~
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:10:9: warning: incompatible implicit declaration of built-in function ‘strcat’ [-Wbuiltin-declaration-mismatch]
10 | strcat(buffer, num_str);
| ^~~~~~
sample_code.c:10: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
Error: start must be less than or equal to end
$ ./sample_test
Test 1: 1 2 3 4 5
Test 2: -2 -1 0 1 2
Test 3: 10
24b-instruct-2512-q4_K_M(GPU使用)
Model
architecture mistral3
parameters 24.0B
context length 393216
embedding length 5120
quantization Q4_K_M
2026-04-27
total duration: 1m26.781704034s
load duration: 94.656871ms
prompt eval count: 774 token(s)
prompt eval duration: 1.841624854s
prompt eval rate: 420.28 tokens/s
eval count: 573 token(s)
eval duration: 1m24.640694473s
eval rate: 6.77 tokens/s
コード生成結果の概要(テストコード以外はGPU無しと同一)
・C言語による生成
・コード以外の出力無し
・コードの記述スタイルのオールマン指定を無視
・関数戻り値は stdlib.h の EXIT_*** を使用
・文字列生成関数
文字列用メモリはchar配列1024バイト固定
インクリメント+空白区切りでバッファに書き込み
バッファへのポインタを返す
・main()
引数個数のチェック(エラー処理有)
開始値、終了値の比較チェック(エラー処理有)
文字列生成関数の呼び出し
生成文字列の標準出力への出力
・テストコードを別途生成
テスト対象関数の宣言
main()を伴うテストコード
文字列生成関数を3種類の引数の組み合わせで呼び出してテスト実行
(1) 整数1 < 整数2
(2) 整数1 < 整数2 ただし 整数1が負数
(3) 整数1 == 整数2
(注) 上記概要は、検証用プロンプトを実測回数分実行した際の結果を使用しています。
LLMの生成結果は毎回一定ではないため、結果によっては上記内容通りではないことが考えられます。
生成コードの実行結果
sample_code.c : 検証用プロンプトにて生成されたコードsample_test.c : 生成されたテストコード
$ gcc -Wall -o sample_code sample_code.c
sample_code.c: In function ‘generate_incremented_string’:
sample_code.c:10:9: warning: implicit declaration of function ‘strcat’ [-Wimplicit-function-declaration]
10 | strcat(buffer, num_str);
| ^~~~~~
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:10:9: warning: incompatible implicit declaration of built-in function ‘strcat’ [-Wbuiltin-declaration-mismatch]
10 | strcat(buffer, num_str);
| ^~~~~~
sample_code.c:10: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 ‘generate_incremented_string’:
sample_code.c:10:9: warning: implicit declaration of function ‘strcat’ [-Wimplicit-function-declaration]
10 | strcat(buffer, num_str);
| ^~~~~~
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:10:9: warning: incompatible implicit declaration of built-in function ‘strcat’ [-Wbuiltin-declaration-mismatch]
10 | strcat(buffer, num_str);
| ^~~~~~
sample_code.c:10:9: note: include ‘<string.h>’ or provide a declaration of ‘strcat’
sample_test.c: In function ‘test_generate_incremented_string’:
sample_test.c:6:20: warning: implicit declaration of function ‘generate_incremented_string’; did you mean ‘test_generate_incremented_string’? [-Wimplicit-function-declaration]
6 | char* result = generate_incremented_string(1, 5);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
| test_generate_incremented_string
sample_test.c:6:20: warning: initialization of ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
sample_test.c:14:12: warning: assignment to ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
14 | result = generate_incremented_string(-2, 2);
| ^
sample_test.c:23:12: warning: assignment to ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
23 | result = generate_incremented_string(10, 10);
| ^
sample_test.c:16:5: warning: ‘__builtin_memcpy’ writing 13 bytes into a region of size 11 overflows the destination [-Wstringop-overflow=]
16 | strcat(expected, "-2 -1 0 1 2 ");
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sample_test.c:7:10: note: destination object ‘expected’ of size 11
7 | char expected[] = "1 2 3 4 5 ";
| ^~~~~~~~
/bin/ld: /tmp/ccwdVDxc.o: in function `main':
sample_test.c:(.text+0x1df): multiple definition of `main'; /tmp/ccfwsQy8.o:sample_code.c:(.text+0xaa): first defined here
collect2: error: ld returned 1 exit status
$ vi sample_code.c ← main()関数重複エラー解消のため条件付きコンパイル用の#ifndefマクロを追加
$ vi sample_test.c ← テスト対象関数の宣言を追加、expected[]の配列添え字を100に修正
$ gcc -D TEST_MAIN -Wall -o sample_test sample_code.c sample_test.c
sample_code.c: In function ‘generate_incremented_string’:
sample_code.c:10:9: warning: implicit declaration of function ‘strcat’ [-Wimplicit-function-declaration]
10 | strcat(buffer, num_str);
| ^~~~~~
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:10:9: warning: incompatible implicit declaration of built-in function ‘strcat’ [-Wbuiltin-declaration-mismatch]
10 | strcat(buffer, num_str);
| ^~~~~~
sample_code.c:10:9: note: include ‘<string.h>’ or provide a declaration of ‘strcat’
$ ./sample_test
Test passed: generate_incremented_string(1, 5)
Test passed: generate_incremented_string(-2, 2)
Test passed: generate_incremented_string(10, 10)