Last Update 2026/07/14
低スペック寄りの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を使用しない
```
モデル詳細
Model
architecture llama4
parameters 108.6B
context length 10485760
embedding length 5120
quantization Q4_K_M
Capabilities
completion
vision
tools
Parameters
stop "<|eom|>"
Llama 4 [実測結果一覧へ]
(1) temperature=0.15; top_p=---; top_k=--
2026-07-10
total duration: 1m49.041943604s
load duration: 138.75467ms
prompt eval count: 520 token(s)
prompt eval duration: 6.051494327s
prompt eval rate: 85.93 tokens/s
eval count: 427 token(s)
eval duration: 1m42.646559702s
eval rate: 4.16 tokens/s
コード生成結果の概要
・C言語による生成
・コード以外にコンパイル方法と使用法を出力
・コードの記述スタイルのオールマン指定を無視
・戻り値は stdlib.h の EXIT_*** を使用
・文字列生成関数
文字列用メモリは必要数算定の上確保およびNULL文字で初期化
インクリメント+空白区切りで文字列用メモリに書き込み
文字列用メモリへのポインタを返す
・main()
引数個数のチェック(エラー処理有)
文字列生成関数の呼び出し
生成文字列の標準出力への出力
文字列用メモリの解放
・テストコードを別途生成
main()を伴うテストコード
文字列生成関数を呼び出してテスト実行
(1) 整数1 < 整数2
(注) 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/cckfdowv.o: in function `main':
sample_test.c:(.text+0x91): multiple definition of `main'; /tmp/cckk7Rzs.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
(2) temperature=0.15; top_p=0.7; top_k=--
2026-07-10
total duration: 1m34.03961492s
load duration: 140.781319ms
prompt eval count: 520 token(s)
prompt eval duration: 278.224759ms
prompt eval rate: 1868.99 tokens/s
eval count: 387 token(s)
eval duration: 1m33.461289332s
eval rate: 4.14 tokens/s
コード生成結果の概要
生成されたコードは(1)と同一コード
・生成されたコメントに一部違いあり
(コメントは英語出力)
(1) char num_str[12]; // 11 digits for a 32-bit int and 1 for the null terminator
(2) char num_str[12]; // 11 digits for a 32-bit integer + 1 for null terminator
・コード以外のコンパイル方法と使用法の出力無し
(3) temperature=0.15; top_p=0.5; top_k=--
2026-07-10
total duration: 1m44.064025344s
load duration: 141.659204ms
prompt eval count: 520 token(s)
prompt eval duration: 469.989868ms
prompt eval rate: 1106.41 tokens/s
eval count: 427 token(s)
eval duration: 1m43.296447294s
eval rate: 4.13 tokens/s
コード生成結果の概要
生成されたコードは(1)と同一コード
(4) temperature=0.15; top_p=0.4; top_k=--
2026-07-10
total duration: 1m34.217657816s
load duration: 150.458813ms
prompt eval count: 520 token(s)
prompt eval duration: 247.45078ms
prompt eval rate: 2101.43 tokens/s
eval count: 387 token(s)
eval duration: 1m33.682170477s
eval rate: 4.13 tokens/s
コード生成結果の概要
生成されたコードは(2)と同一コード
・コード以外のコンパイル方法と使用法の出力無し
(5) temperature=0.15; top_p=0.7; top_k=32
2026-07-10
total duration: 1m51.026310352s
load duration: 145.5283ms
prompt eval count: 520 token(s)
prompt eval duration: 7.02434975s
prompt eval rate: 74.03 tokens/s
eval count: 427 token(s)
eval duration: 1m43.624644492s
eval rate: 4.12 tokens/s
コード生成結果の概要
生成されたコードは(1)と同一コード
(6) temperature=0.15; top_p=0.7; top_k=16
2026-07-10
total duration: 1m27.673078176s
load duration: 146.948791ms
prompt eval count: 520 token(s)
prompt eval duration: 250.658745ms
prompt eval rate: 2074.53 tokens/s
eval count: 362 token(s)
eval duration: 1m27.154651284s
eval rate: 4.15 tokens/s
コード生成結果の概要
・C言語による生成
・コード以外の出力無し
・コードの記述スタイルのオールマン指定を無視
・戻り値は 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_test.c: In function ‘test_generate_output’:
sample_test.c:7:11: warning: unused variable ‘stdout_save’ [-Wunused-variable]
7 | FILE *stdout_save = stdout;
| ^~~~~~~~~~~
$ ./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
$ cat test_output.txt
1 2 3 4 5
Test failed ← テストが失敗し、結果の出力先がファイルになっている
$ vi sample_test.c ← 出力先を戻すため freopen("/dev/tty", "w", stdout) を追加
$ gcc -Wall -o sample_test sample_test.c
sample_test.c: In function ‘test_generate_output’:
sample_test.c:7:11: warning: unused variable ‘stdout_save’ [-Wunused-variable]
7 | FILE *stdout_save = stdout;
| ^~~~~~~~~~~
$ ./sample_test
Test passed
(7) temperature=0.10; top_p=0.7; top_k=--
2026-07-10
total duration: 1m27.594354333s
load duration: 142.992448ms
prompt eval count: 520 token(s)
prompt eval duration: 256.934253ms
prompt eval rate: 2023.86 tokens/s
eval count: 362 token(s)
eval duration: 1m27.06109464s
eval rate: 4.16 tokens/s
コード生成結果の概要
生成されたコードは(6)と同一コード