Last Update 2026/04/27
低スペック寄りの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を使用しない
```
Llama 4 [実測結果一覧へ]
GPU無し
17b-scout-16e-instruct-q4_K_M(3.67TPS)
GPU使用
17b-scout-16e-instruct-q4_K_M(4.18TPS)
17b-scout-16e-instruct-q4_K_M(GPU無し)
Model
architecture llama4
parameters 108.6B
context length 10485760
embedding length 5120
quantization Q4_K_M
2026-04-27
total duration: 2m39.147116599s
load duration: 252.435419ms
prompt eval count: 520 token(s)
prompt eval duration: 42.355012571s
prompt eval rate: 12.28 tokens/s
eval count: 426 token(s)
eval duration: 1m56.174485201s
eval rate: 3.67 tokens/s
コード生成結果の概要
・C言語による生成
・コード以外にコンパイル方法と使用法を出力
・コードの記述スタイルのオールマン指定を無視
・標準ヘッダ以外の使用無し
・関数はmain()の前で定義
・文字列生成関数
文字列用メモリは必要数算定の上確保およびNULL文字で初期化
インクリメント+空白区切りで文字列用メモリに書き込み
文字列用メモリへのポインタを返す
・main()
引数個数のチェック(エラー処理有)
文字列生成関数の呼び出し
生成文字列の標準出力への出力
・テストコードを別途生成
main()を伴うテストコード
文字列生成関数を呼び出してテスト実行
(1) 整数1 < 整数2
・関数戻り値は stdlib.h の EXIT_*** を使用
(注) 上記概要は、検証用プロンプトを実測回数分実行した際の結果を使用しています。
LLMの生成結果は毎回一定ではないため、結果によっては上記内容通りではないことが考えられます。
生成コードの実行結果
sample_code.c : 検証用プロンプトにて生成されたコードsample_test.c : 検証用プロンプトにて生成されたテストコード
$ gcc -Wall -o sample_code sample_code.c
sample_code.c: In function ‘generate_output’:
sample_code.c:11:9: warning: implicit declaration of function ‘strcat’ [-Wimplicit-function-declaration]
11 | strcat(output, 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:11:9: warning: incompatible implicit declaration of built-in function ‘strcat’ [-Wbuiltin-declaration-mismatch]
11 | strcat(output, num_str);
| ^~~~~~
sample_code.c:11: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_output’:
sample_code.c:11:9: warning: implicit declaration of function ‘strcat’ [-Wimplicit-function-declaration]
11 | strcat(output, 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:11:9: warning: incompatible implicit declaration of built-in function ‘strcat’ [-Wbuiltin-declaration-mismatch]
11 | strcat(output, num_str);
| ^~~~~~
sample_code.c:11:9: note: include ‘<string.h>’ or provide a declaration of ‘strcat’
sample_test.c: In function ‘test_generate_output’:
sample_test.c:9:20: warning: implicit declaration of function ‘generate_output’; did you mean ‘test_generate_output’? [-Wimplicit-function-declaration]
9 | char* output = generate_output(start, end);
| ^~~~~~~~~~~~~~~
| test_generate_output
sample_test.c:9:20: warning: initialization of ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
/bin/ld: /tmp/ccHL0kMD.o: in function `main':
sample_test.c:(.text+0x4b): multiple definition of `main'; /tmp/ccjPTh1A.o:sample_code.c:(.text+0xa4): 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_output’:
sample_code.c:11:9: warning: implicit declaration of function ‘strcat’ [-Wimplicit-function-declaration]
11 | strcat(output, 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:11:9: warning: incompatible implicit declaration of built-in function ‘strcat’ [-Wbuiltin-declaration-mismatch]
11 | strcat(output, num_str);
| ^~~~~~
sample_code.c:11: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
Segmentation fault (core dumped)
$ ./sample_test
1 2 3 4 5
17b-scout-16e-instruct-q4_K_M(GPU使用)
Model
architecture llama4
parameters 108.6B
context length 10485760
embedding length 5120
quantization Q4_K_M
2026-04-27
total duration: 1m39.163861428s
load duration: 132.176137ms
prompt eval count: 520 token(s)
prompt eval duration: 6.076464481s
prompt eval rate: 85.58 tokens/s
eval count: 388 token(s)
eval duration: 1m32.774352104s
eval rate: 4.18 tokens/s
コード生成結果の概要
・C言語による生成
・コード以外にコンパイル方法と使用法を出力
・コードの記述スタイルのオールマン指定を無視
・標準ヘッダ以外の使用無し
・関数はmain()の前で定義
・文字列生成関数
文字列用メモリは必要数算定の上確保およびNULL文字で初期化
インクリメント+空白区切りで文字列用メモリに書き込み
文字列用メモリへのポインタを返す
・main()
引数個数のチェック(エラー処理有)
文字列生成関数の呼び出し
生成文字列の標準出力への出力
・テストコードを別途生成
main()を伴うテストコード
文字列生成関数を呼び出してテスト実行
(1) 整数1 < 整数2
・関数戻り値は stdlib.h の EXIT_*** を使用
(注) 上記概要は、検証用プロンプトを実測回数分実行した際の結果を使用しています。
LLMの生成結果は毎回一定ではないため、結果によっては上記内容通りではないことが考えられます。
生成コードの実行結果
sample_code.c : 検証用プロンプトにて生成されたコードsample_test.c : 検証用プロンプトにて生成されたテストコード
$ gcc -Wall -o sample_code sample_code.c
sample_code.c: In function ‘generate_output’:
sample_code.c:11:9: warning: implicit declaration of function ‘strcat’ [-Wimplicit-function-declaration]
11 | strcat(output, 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:11:9: warning: incompatible implicit declaration of built-in function ‘strcat’ [-Wbuiltin-declaration-mismatch]
11 | strcat(output, num_str);
| ^~~~~~
sample_code.c:11: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_output’:
sample_code.c:11:9: warning: implicit declaration of function ‘strcat’ [-Wimplicit-function-declaration]
11 | strcat(output, 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:11:9: warning: incompatible implicit declaration of built-in function ‘strcat’ [-Wbuiltin-declaration-mismatch]
11 | strcat(output, num_str);
| ^~~~~~
sample_code.c:11:9: note: include ‘<string.h>’ or provide a declaration of ‘strcat’
sample_test.c: In function ‘test_generate_output’:
sample_test.c:11:20: warning: implicit declaration of function ‘generate_output’; did you mean ‘test_generate_output’? [-Wimplicit-function-declaration]
11 | char* output = generate_output(start, end);
| ^~~~~~~~~~~~~~~
| test_generate_output
sample_test.c:11:20: warning: initialization of ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
/bin/ld: /tmp/ccSrGwB3.o: in function `main':
sample_test.c:(.text+0x91): multiple definition of `main'; /tmp/cccpTZ69.o:sample_code.c:(.text+0xa4): 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_output’:
sample_code.c:11:9: warning: implicit declaration of function ‘strcat’ [-Wimplicit-function-declaration]
11 | strcat(output, 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:11:9: warning: incompatible implicit declaration of built-in function ‘strcat’ [-Wbuiltin-declaration-mismatch]
11 | strcat(output, num_str);
| ^~~~~~
sample_code.c:11: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
Segmentation fault (core dumped)
$ ./sample_test
Test passed