Last Update 2026/04/30
低スペック寄りの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を使用しない
```
LFM2 [実測結果一覧へ]
GPU無し
24b-q4_K_M(25.65TPS)
GPU使用
24b-q4_K_M(52.97TPS)
24b-q4_K_M(GPU無し)
Model
architecture lfm2moe
parameters 23.8B
context length 32768
embedding length 2048
quantization Q4_K_M
requires 0.17.1
2026-04-30
total duration: 15.480218733s
load duration: 48.654862ms
prompt eval count: 217 token(s)
prompt eval duration: 2.334624349s
prompt eval rate: 92.95 tokens/s
eval count: 334 token(s)
eval duration: 13.023580237s
eval rate: 25.65 tokens/s
コード生成結果の概要
・C言語による生成
・コード以外の出力無し
・コードの記述スタイルのオールマン指定を無視
・標準ヘッダ以外の使用無し
・main()関数のみの構成
・関数戻り値は stdlib.h の EXIT_*** を使用
・main()
引数個数のチェック(エラー処理有)
文字列出力
・テストコードを別途生成
main()のみのテストコード
テストコードがテスト対象の生成コードと全く別物であるため動作テストにならない
テストは1ケースのみ
整数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_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
24b-q4_K_M(GPU使用)
Model
architecture lfm2moe
parameters 23.8B
context length 32768
embedding length 2048
quantization Q4_K_M
requires 0.17.1
2026-04-30
total duration: 18.696579738s
load duration: 47.651787ms
prompt eval count: 217 token(s)
prompt eval duration: 417.952786ms
prompt eval rate: 519.20 tokens/s
eval count: 957 token(s)
eval duration: 18.068342172s
eval rate: 52.97 tokens/s
コード生成結果の概要
・C言語による生成
・コード以外の出力無し
・コードの記述スタイルのオールマン指定を無視
・標準ヘッダ以外の使用無し
・関数はmain()の前で宣言
・関数戻り値は stdlib.h の EXIT_*** を使用
・文字列生成関数
文字列生成ではなく出力
・main()
引数個数のチェック(エラー処理有)
引数値大小のチェック(エラー処理有)
文字列生成関数の呼び出し
・テストコードを別途生成
テストコードファイル内の構成が意味不明
関数プロトタイプ宣言 : void test_print_range(void);
テスト関数定義 : void test_print_range(void) {}
テスト実行関数(本来はmain()) : void test_print_range(void) {}
main()関数が無く実行不能
文字列生成関数を3種類の引数の組み合わせでテスト実行
(1) 整数1 < 整数2
(2) 整数1 == 整数2
(3) 整数1 == 整数2 (整数1と整数2は0)
(注) 上記概要は、検証用プロンプトを実測回数分実行した際の結果を使用しています。
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 ‘test_print_range’:
sample_test.c:15:9: warning: implicit declaration of function ‘setup_stdout_redirect’ [-Wimplicit-function-declaration]
15 | if (setup_stdout_redirect(buffer, &original_stdout) != 0) {
| ^~~~~~~~~~~~~~~~~~~~~
sample_test.c:20:5: error: too many arguments to function ‘test_print_range’
20 | test_print_range(1, 3);
| ^~~~~~~~~~~~~~~~
sample_test.c:8:6: note: declared here
8 | void test_print_range(void) {
| ^~~~~~~~~~~~~~~~
sample_test.c:23:9: warning: implicit declaration of function ‘strcmp’ [-Wimplicit-function-declaration]
23 | if (strcmp(buffer, "1 2 3 \n") != 0) {
| ^~~~~~
sample_test.c:3:1: note: include ‘<string.h>’ or provide a declaration of ‘strcmp’
2 | #include <stdlib.h>
+++ |+#include <string.h>
3 |
sample_test.c:28:5: error: too many arguments to function ‘test_print_range’
28 | test_print_range(5, 5);
| ^~~~~~~~~~~~~~~~
sample_test.c:8:6: note: declared here
8 | void test_print_range(void) {
| ^~~~~~~~~~~~~~~~
sample_test.c:36:5: error: too many arguments to function ‘test_print_range’
36 | test_print_range(0, 0);
| ^~~~~~~~~~~~~~~~
sample_test.c:8:6: note: declared here
8 | void test_print_range(void) {
| ^~~~~~~~~~~~~~~~
sample_test.c:44:5: warning: implicit declaration of function ‘restore_stdout’ [-Wimplicit-function-declaration]
44 | restore_stdout(original_stdout);
| ^~~~~~~~~~~~~~
sample_test.c:11:9: warning: unused variable ‘saved_stdout’ [-Wunused-variable]
11 | int saved_stdout = 1; // 標準出力の保存
| ^~~~~~~~~~~~
sample_test.c: At top level:
sample_test.c:48:6: error: redefinition of ‘test_print_range’
48 | void test_print_range(void) {
| ^~~~~~~~~~~~~~~~
sample_test.c:8:6: note: previous definition of ‘test_print_range’ with type ‘void(void)’
8 | void test_print_range(void) {
| ^~~~~~~~~~~~~~~~
sample_test.c: In function ‘test_print_range’:
sample_test.c:49:5: warning: implicit declaration of function ‘print_range’; did you mean ‘test_print_range’? [-Wimplicit-function-declaration]
49 | print_range(1, 3);
| ^~~~~~~~~~~
| test_print_range
sample_test.c: In function ‘setup_stdout_redirect’:
sample_test.c:67:24: error: incompatible types when assigning to type ‘FILE *’ from type ‘FILE’
67 | *original_stdout = *stdout;
| ^
sample_test.c: At top level:
sample_test.c:72:6: warning: conflicting types for ‘restore_stdout’; have ‘void(FILE *)’
72 | void restore_stdout(FILE *original_stdout) {
| ^~~~~~~~~~~~~~
sample_test.c:44:5: note: previous implicit declaration of ‘restore_stdout’ with type ‘void(FILE *)’
44 | restore_stdout(original_stdout);
| ^~~~~~~~~~~~~~
In file included from /usr/include/stdlib.h:32,
from sample_test.c:2:
sample_test.c: In function ‘restore_stdout’:
sample_test.c:75:28: error: incompatible types when assigning to type ‘FILE’ from type ‘void *’
75 | *original_stdout = NULL;
| ^~~~
sample_test.c:76:17: warning: passing argument 1 of ‘freopen’ from incompatible pointer type [-Wincompatible-pointer-types]
76 | freopen(stdout, "w", original_stdout);
| ^~~~~~
| |
| FILE *
In file included from sample_test.c:1:
/usr/include/stdio.h:271:46: note: expected ‘const char * restrict’ but argument is of type ‘FILE *’
271 | extern FILE *freopen (const char *__restrict __filename,
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
$ ./sample_code 1 4
1 2 3 4
$ ./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