SafeLLM4SE 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. safellm4se-0.1.1/LICENSE +21 -0
  2. safellm4se-0.1.1/MANIFEST.in +14 -0
  3. safellm4se-0.1.1/PKG-INFO +166 -0
  4. safellm4se-0.1.1/README.md +102 -0
  5. safellm4se-0.1.1/doc/cli-reference.md +182 -0
  6. safellm4se-0.1.1/doc/evaluators.md +215 -0
  7. safellm4se-0.1.1/doc/installation.md +131 -0
  8. safellm4se-0.1.1/doc/methodology.md +85 -0
  9. safellm4se-0.1.1/doc/usage.md +153 -0
  10. safellm4se-0.1.1/pyproject.toml +73 -0
  11. safellm4se-0.1.1/setup.cfg +4 -0
  12. safellm4se-0.1.1/src/SafeLLM4SE.egg-info/PKG-INFO +166 -0
  13. safellm4se-0.1.1/src/SafeLLM4SE.egg-info/SOURCES.txt +67 -0
  14. safellm4se-0.1.1/src/SafeLLM4SE.egg-info/dependency_links.txt +1 -0
  15. safellm4se-0.1.1/src/SafeLLM4SE.egg-info/entry_points.txt +4 -0
  16. safellm4se-0.1.1/src/SafeLLM4SE.egg-info/requires.txt +17 -0
  17. safellm4se-0.1.1/src/SafeLLM4SE.egg-info/top_level.txt +1 -0
  18. safellm4se-0.1.1/src/safellm4se/__init__.py +13 -0
  19. safellm4se-0.1.1/src/safellm4se/compare.py +57 -0
  20. safellm4se-0.1.1/src/safellm4se/comparing/__init__.py +0 -0
  21. safellm4se-0.1.1/src/safellm4se/comparing/cli.py +176 -0
  22. safellm4se-0.1.1/src/safellm4se/comparing/comparator.py +58 -0
  23. safellm4se-0.1.1/src/safellm4se/comparing/metrics.py +722 -0
  24. safellm4se-0.1.1/src/safellm4se/comparing/models.py +67 -0
  25. safellm4se-0.1.1/src/safellm4se/comparing/plots.py +335 -0
  26. safellm4se-0.1.1/src/safellm4se/comparing/writer.py +30 -0
  27. safellm4se-0.1.1/src/safellm4se/py.typed +1 -0
  28. safellm4se-0.1.1/src/safellm4se/report.py +58 -0
  29. safellm4se-0.1.1/src/safellm4se/reporting/__init__.py +13 -0
  30. safellm4se-0.1.1/src/safellm4se/reporting/cli.py +180 -0
  31. safellm4se-0.1.1/src/safellm4se/reporting/metrics.py +259 -0
  32. safellm4se-0.1.1/src/safellm4se/reporting/models.py +22 -0
  33. safellm4se-0.1.1/src/safellm4se/reporting/plots.py +368 -0
  34. safellm4se-0.1.1/src/safellm4se/reporting/reader.py +107 -0
  35. safellm4se-0.1.1/src/safellm4se/reporting/reporter.py +45 -0
  36. safellm4se-0.1.1/src/safellm4se/reporting/writer.py +30 -0
  37. safellm4se-0.1.1/src/safellm4se/sample.py +63 -0
  38. safellm4se-0.1.1/src/safellm4se/sampling/__init__.py +6 -0
  39. safellm4se-0.1.1/src/safellm4se/sampling/cli.py +448 -0
  40. safellm4se-0.1.1/src/safellm4se/sampling/config/__init__.py +5 -0
  41. safellm4se-0.1.1/src/safellm4se/sampling/config/config.py +33 -0
  42. safellm4se-0.1.1/src/safellm4se/sampling/config/logger.py +89 -0
  43. safellm4se-0.1.1/src/safellm4se/sampling/evaluators.py +312 -0
  44. safellm4se-0.1.1/src/safellm4se/sampling/locking.py +37 -0
  45. safellm4se-0.1.1/src/safellm4se/sampling/models.py +40 -0
  46. safellm4se-0.1.1/src/safellm4se/sampling/myevaluators/__init__.py +1 -0
  47. safellm4se-0.1.1/src/safellm4se/sampling/myevaluators/base_evaluator.py +119 -0
  48. safellm4se-0.1.1/src/safellm4se/sampling/myevaluators/gemini/__init__.py +0 -0
  49. safellm4se-0.1.1/src/safellm4se/sampling/myevaluators/gemini/common.py +540 -0
  50. safellm4se-0.1.1/src/safellm4se/sampling/myevaluators/gemini/humaneval_fullbench.py +226 -0
  51. safellm4se-0.1.1/src/safellm4se/sampling/myevaluators/gemini/humaneval_oneprogram.py +110 -0
  52. safellm4se-0.1.1/src/safellm4se/sampling/myevaluators/gemini/random.py +73 -0
  53. safellm4se-0.1.1/src/safellm4se/sampling/myevaluators/grok_evaluator.py +143 -0
  54. safellm4se-0.1.1/src/safellm4se/sampling/myevaluators/groq/__init__.py +1 -0
  55. safellm4se-0.1.1/src/safellm4se/sampling/myevaluators/groq/common.py +605 -0
  56. safellm4se-0.1.1/src/safellm4se/sampling/myevaluators/groq/humaneval_fullbench.py +223 -0
  57. safellm4se-0.1.1/src/safellm4se/sampling/myevaluators/groq/humaneval_oneprogram.py +108 -0
  58. safellm4se-0.1.1/src/safellm4se/sampling/myevaluators/groq/random.py +79 -0
  59. safellm4se-0.1.1/src/safellm4se/sampling/myevaluators/ollama/__init__.py +0 -0
  60. safellm4se-0.1.1/src/safellm4se/sampling/myevaluators/ollama/common.py +489 -0
  61. safellm4se-0.1.1/src/safellm4se/sampling/myevaluators/ollama/humaneval_fullbench.py +186 -0
  62. safellm4se-0.1.1/src/safellm4se/sampling/myevaluators/ollama/humaneval_oneprogram.py +108 -0
  63. safellm4se-0.1.1/src/safellm4se/sampling/myevaluators/ollama/random.py +71 -0
  64. safellm4se-0.1.1/src/safellm4se/sampling/myevaluators/random_binary_evaluator.py +81 -0
  65. safellm4se-0.1.1/src/safellm4se/sampling/myevaluators/random_normal_evaluator.py +90 -0
  66. safellm4se-0.1.1/src/safellm4se/sampling/persistence.py +477 -0
  67. safellm4se-0.1.1/src/safellm4se/sampling/sampler.py +198 -0
  68. safellm4se-0.1.1/src/safellm4se/sampling/statistics.py +35 -0
  69. safellm4se-0.1.1/src/safellm4se/statistical_utils.py +446 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Francisco Ortin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,14 @@
1
+ include LICENSE
2
+ include PUBLISHING.md
3
+ include README.md
4
+ recursive-include doc *.md
5
+ recursive-exclude * __pycache__
6
+ recursive-exclude * *.py[cod]
7
+ recursive-exclude output *
8
+ recursive-exclude logs *
9
+ recursive-exclude .idea *
10
+ exclude paper-v05.tex
11
+ exclude paper-v3.tex
12
+ exclude paper-v3-changes.tex
13
+ exclude sampling/myevaluators/api-keys.json
14
+ exclude src/safellm4se/sampling/myevaluators/api-keys.json
@@ -0,0 +1,166 @@
1
+ Metadata-Version: 2.4
2
+ Name: SafeLLM4SE
3
+ Version: 0.1.1
4
+ Summary: Statistical evaluation and reporting for LLM-based software engineering systems.
5
+ Author: Francisco Ortin
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 Francisco Ortin
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/francisco-ortin/SafeLLM4SE
29
+ Project-URL: Documentation, https://github.com/francisco-ortin/SafeLLM4SE/tree/main/doc
30
+ Project-URL: Repository, https://github.com/francisco-ortin/SafeLLM4SE
31
+ Project-URL: Issues, https://github.com/francisco-ortin/SafeLLM4SE/issues
32
+ Keywords: llm,software-engineering,statistics,evaluation,sampling
33
+ Classifier: Development Status :: 3 - Alpha
34
+ Classifier: Environment :: Console
35
+ Classifier: Intended Audience :: Developers
36
+ Classifier: Intended Audience :: Science/Research
37
+ Classifier: License :: OSI Approved :: MIT License
38
+ Classifier: Natural Language :: English
39
+ Classifier: Operating System :: OS Independent
40
+ Classifier: Programming Language :: Python :: 3
41
+ Classifier: Programming Language :: Python :: 3.10
42
+ Classifier: Programming Language :: Python :: 3.11
43
+ Classifier: Programming Language :: Python :: 3.12
44
+ Classifier: Programming Language :: Python :: 3.13
45
+ Classifier: Topic :: Scientific/Engineering
46
+ Classifier: Topic :: Software Development :: Quality Assurance
47
+ Requires-Python: >=3.10
48
+ Description-Content-Type: text/markdown
49
+ License-File: LICENSE
50
+ Requires-Dist: loguru>=0.7
51
+ Requires-Dist: matplotlib>=3.8
52
+ Requires-Dist: scipy>=1.11
53
+ Provides-Extra: datasets
54
+ Requires-Dist: datasets>=2.18; extra == "datasets"
55
+ Provides-Extra: gemini
56
+ Requires-Dist: google-genai>=1.0; extra == "gemini"
57
+ Provides-Extra: groq
58
+ Requires-Dist: groq>=0.9; extra == "groq"
59
+ Provides-Extra: all
60
+ Requires-Dist: datasets>=2.18; extra == "all"
61
+ Requires-Dist: google-genai>=1.0; extra == "all"
62
+ Requires-Dist: groq>=0.9; extra == "all"
63
+ Dynamic: license-file
64
+
65
+ # SafeLLM4SE
66
+
67
+ [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
68
+ [![Latest release](https://img.shields.io/github/v/release/francisco-ortin/SafeLLM4SE?include_prereleases)](https://github.com/francisco-ortin/SafeLLM4SE/releases)
69
+ [![PyPI](https://img.shields.io/pypi/v/safellm4se)](https://pypi.org/project/safellm4se/)
70
+
71
+ SafeLLM4SE is a Python toolkit for statistically principled evaluation of
72
+ LLM-based software engineering systems. It treats each LLM execution as a
73
+ sample from a stochastic process, then reports quality, stability, uncertainty,
74
+ resource usage, and statistical comparisons instead of relying on a single run.
75
+
76
+ The project exposes three command-line programs:
77
+
78
+ - `safellm4se-sample`: runs adaptive sampling with a user-selected evaluator.
79
+ - `safellm4se-report`: summarizes one sampled task into a SafeLLM4SE report CSV.
80
+ - `safellm4se-compare`: compares two sampled tasks with the SafeLLM4SE comparison protocol.
81
+
82
+ ## Install
83
+
84
+ SafeLLM4SE is available on PyPI as `safellm4se`, so you only need to run:
85
+
86
+ ```bash
87
+ pip install "SafeLLM4SE[all]"
88
+ ```
89
+
90
+ If you want to install SafeLLM4SE from its source code, check the [installation details](doc/installation.md).
91
+
92
+ ## Quick Start
93
+
94
+ SafeLLM4SE collects repeated observations with `safellm4se-sample`.
95
+ Then, it can be used to report or visualize one sample of observations with `safellm4se-report`,
96
+ or compare task samples with `safellm4se-compare`.
97
+
98
+ ### Sampling
99
+
100
+ First, you need to generate a sample of repeated observations.
101
+ For this purpose, `safellm4se-sample` loads an evaluator class and repeatedly calls it until a stopping condition is met
102
+ (maximum number of tokens consumed or the confidence interval width is below a threshold).
103
+ You commonly implement the process being measured as an evaluator,
104
+ but we provide several example evaluators, including default implementations for [Ollama](https://ollama.com/),
105
+ [Gemini](https://ai.google.dev/gemini-api/docs), and [Groq](https://console.groq.com/) APIs.
106
+
107
+ For this example, we perform adaptive sampling on a random evaluator:
108
+
109
+ ```bash
110
+ safellm4se-sample --evaluator safellm4se.sampling.myevaluators.random_normal_evaluator
111
+ ```
112
+
113
+ ### Reporting
114
+
115
+ If you have already created a sample of repeated observations with the task identifier `task-id-1`,
116
+ stored in `output/measurements.csv`,
117
+ you can create reports and visualizations with `safellm4se-report`.
118
+ The report includes the sample size, token usage, central tendency, variability, and confidence interval information.
119
+ The supported visualizations are boxplot, violin plot, empirical cumulative distribution function (ECDF), raincloud plot, and kernel density estimate (KDE).
120
+
121
+ ```bash
122
+ safellm4se-report --input output/measurements.csv --output output/report-demo.csv --task-id task-id-1 --boxplot output/demo-boxplot.svg
123
+ ```
124
+
125
+ Example CSV report generated with `safellm4se-report`:
126
+
127
+ ```csv
128
+ task_id,model_name,model_id,N,total_tokens,theta_mean,sd,ci_method,ci_low,ci_high,ci_width
129
+ task-id-54,qwen-coder,qwen2.5-coder:7b,30,1178530,0.8272357723577236,0.019436705668000667,t,0.8199779871829312,0.834493557532516,0.014515570349584728
130
+ ```
131
+
132
+ ### Comparing
133
+
134
+ You can also compare two samples of repeated observations with `safellm4se-compare`.
135
+ The report will tell you the estimated difference, confidence interval, statistical test,
136
+ p-value, and effect size.
137
+ It also generates figures comparing the two samples, including the visualizations mentioned in
138
+ [reporting](#reporting).
139
+
140
+ ```bash
141
+ safellm4se-compare --input output/measurements.csv --output output/comparing-demo.csv --task-id-1 task-a --task-id-2 task-b --test-type paired --raincloud output/comparing-demo-raincloud.svg
142
+ ```
143
+
144
+ Example plot generated with `safellm4se-compare`:
145
+
146
+ ![Two-sample raincloud plot](output/compare-deepseek-qwen-raincloud.svg)
147
+
148
+ The following CSV comparison report has also been generated:
149
+
150
+ ```csv
151
+ task_id_1,task_id_2,test_type,estimated_difference,ci_low,ci_high,statistical_test,p_value,effect_size_name,effect_size,effect_size_magnitude
152
+ task-id-54,task-id-56,independent,0.20833333333333337,0.19369410569105683,0.2223628048780488,Mann-Whitney U,2.8591961948613224e-11,Cliff's delta,1.0,large
153
+ ```
154
+
155
+
156
+ ## Documentation
157
+
158
+ - [Methodology](doc/methodology.md)
159
+ - [Installation](doc/installation.md)
160
+ - [Usage Guide](doc/usage.md)
161
+ - [CLI Reference](doc/cli-reference.md)
162
+ - [Evaluator Guide](doc/evaluators.md)
163
+
164
+ ## License
165
+
166
+ See [LICENSE](LICENSE).
@@ -0,0 +1,102 @@
1
+ # SafeLLM4SE
2
+
3
+ [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
4
+ [![Latest release](https://img.shields.io/github/v/release/francisco-ortin/SafeLLM4SE?include_prereleases)](https://github.com/francisco-ortin/SafeLLM4SE/releases)
5
+ [![PyPI](https://img.shields.io/pypi/v/safellm4se)](https://pypi.org/project/safellm4se/)
6
+
7
+ SafeLLM4SE is a Python toolkit for statistically principled evaluation of
8
+ LLM-based software engineering systems. It treats each LLM execution as a
9
+ sample from a stochastic process, then reports quality, stability, uncertainty,
10
+ resource usage, and statistical comparisons instead of relying on a single run.
11
+
12
+ The project exposes three command-line programs:
13
+
14
+ - `safellm4se-sample`: runs adaptive sampling with a user-selected evaluator.
15
+ - `safellm4se-report`: summarizes one sampled task into a SafeLLM4SE report CSV.
16
+ - `safellm4se-compare`: compares two sampled tasks with the SafeLLM4SE comparison protocol.
17
+
18
+ ## Install
19
+
20
+ SafeLLM4SE is available on PyPI as `safellm4se`, so you only need to run:
21
+
22
+ ```bash
23
+ pip install "SafeLLM4SE[all]"
24
+ ```
25
+
26
+ If you want to install SafeLLM4SE from its source code, check the [installation details](doc/installation.md).
27
+
28
+ ## Quick Start
29
+
30
+ SafeLLM4SE collects repeated observations with `safellm4se-sample`.
31
+ Then, it can be used to report or visualize one sample of observations with `safellm4se-report`,
32
+ or compare task samples with `safellm4se-compare`.
33
+
34
+ ### Sampling
35
+
36
+ First, you need to generate a sample of repeated observations.
37
+ For this purpose, `safellm4se-sample` loads an evaluator class and repeatedly calls it until a stopping condition is met
38
+ (maximum number of tokens consumed or the confidence interval width is below a threshold).
39
+ You commonly implement the process being measured as an evaluator,
40
+ but we provide several example evaluators, including default implementations for [Ollama](https://ollama.com/),
41
+ [Gemini](https://ai.google.dev/gemini-api/docs), and [Groq](https://console.groq.com/) APIs.
42
+
43
+ For this example, we perform adaptive sampling on a random evaluator:
44
+
45
+ ```bash
46
+ safellm4se-sample --evaluator safellm4se.sampling.myevaluators.random_normal_evaluator
47
+ ```
48
+
49
+ ### Reporting
50
+
51
+ If you have already created a sample of repeated observations with the task identifier `task-id-1`,
52
+ stored in `output/measurements.csv`,
53
+ you can create reports and visualizations with `safellm4se-report`.
54
+ The report includes the sample size, token usage, central tendency, variability, and confidence interval information.
55
+ The supported visualizations are boxplot, violin plot, empirical cumulative distribution function (ECDF), raincloud plot, and kernel density estimate (KDE).
56
+
57
+ ```bash
58
+ safellm4se-report --input output/measurements.csv --output output/report-demo.csv --task-id task-id-1 --boxplot output/demo-boxplot.svg
59
+ ```
60
+
61
+ Example CSV report generated with `safellm4se-report`:
62
+
63
+ ```csv
64
+ task_id,model_name,model_id,N,total_tokens,theta_mean,sd,ci_method,ci_low,ci_high,ci_width
65
+ task-id-54,qwen-coder,qwen2.5-coder:7b,30,1178530,0.8272357723577236,0.019436705668000667,t,0.8199779871829312,0.834493557532516,0.014515570349584728
66
+ ```
67
+
68
+ ### Comparing
69
+
70
+ You can also compare two samples of repeated observations with `safellm4se-compare`.
71
+ The report will tell you the estimated difference, confidence interval, statistical test,
72
+ p-value, and effect size.
73
+ It also generates figures comparing the two samples, including the visualizations mentioned in
74
+ [reporting](#reporting).
75
+
76
+ ```bash
77
+ safellm4se-compare --input output/measurements.csv --output output/comparing-demo.csv --task-id-1 task-a --task-id-2 task-b --test-type paired --raincloud output/comparing-demo-raincloud.svg
78
+ ```
79
+
80
+ Example plot generated with `safellm4se-compare`:
81
+
82
+ ![Two-sample raincloud plot](output/compare-deepseek-qwen-raincloud.svg)
83
+
84
+ The following CSV comparison report has also been generated:
85
+
86
+ ```csv
87
+ task_id_1,task_id_2,test_type,estimated_difference,ci_low,ci_high,statistical_test,p_value,effect_size_name,effect_size,effect_size_magnitude
88
+ task-id-54,task-id-56,independent,0.20833333333333337,0.19369410569105683,0.2223628048780488,Mann-Whitney U,2.8591961948613224e-11,Cliff's delta,1.0,large
89
+ ```
90
+
91
+
92
+ ## Documentation
93
+
94
+ - [Methodology](doc/methodology.md)
95
+ - [Installation](doc/installation.md)
96
+ - [Usage Guide](doc/usage.md)
97
+ - [CLI Reference](doc/cli-reference.md)
98
+ - [Evaluator Guide](doc/evaluators.md)
99
+
100
+ ## License
101
+
102
+ See [LICENSE](LICENSE).
@@ -0,0 +1,182 @@
1
+ # CLI Reference
2
+
3
+
4
+ This reference shows the arguments and options for the three command-line tools in SafeLLM4SE.
5
+ That is, it reflects the current Python parsers in
6
+ `src/safellm4se/sampling/cli.py`, `src/safellm4se/reporting/cli.py`, and
7
+ `src/safellm4se/compare/cli.py`.
8
+
9
+ ## `safellm4se-sample`
10
+
11
+ Purpose: run adaptive sampling for one task/model/evaluator key.
12
+
13
+ ```bash
14
+ safellm4se-sample --evaluator MODULE[:CLASS] [options] -- evaluator_parameter=value
15
+ ```
16
+
17
+ Options:
18
+
19
+ | Option | Default | Description |
20
+ |---|---:|---|
21
+ | `--evaluator`, `--evaluador` | Required | Evaluator module or `module:ClassName` reference. |
22
+ | `--output-dir` | `output` | Directory for measurements, logs, lock file, and reservations. |
23
+ | `--task-id` | Next `task-id-<n>` | Task identifier written to the measurement rows. |
24
+ | `--ci-method` | `auto` | Continuous CI method: `auto`, `t`, or `bootstrap`. Binary metrics always use Wilson. |
25
+ | `--confidence-level` | `0.95` | Confidence level as a fraction in `(0, 1)`. |
26
+ | `--n-min` | `10` | Minimum observations before the sampler may stop. |
27
+ | `--target-ci-width` | `0.10` | Maximum accepted total confidence interval width. |
28
+ | `--budget-tokens` | `10000` | Maximum token budget for the current task/experiment/model key. |
29
+ | `--inter-invocation-waiting` | `0.0` | Seconds to wait before each evaluator invocation. |
30
+ | `--reservation-ttl-seconds` | `3600.0` | Seconds before an unfinished execution reservation expires. |
31
+ | `--verbose` | `False` | Print INFO and higher logs to the console. |
32
+ | `--log LEVEL` | Disabled | Print logs from `DEBUG`, `INFO`, `WARNING`, `ERROR`, or `CRITICAL`. |
33
+ | `--h` | | Show help. |
34
+
35
+ Evaluator parameters:
36
+
37
+ - Put evaluator-specific arguments after the separator `--`. Any parameter name can be passed. The evaluator developer can use it during object initialization (in `__init__`).
38
+ - Use `name=value` or `--name=value`.
39
+ - Hyphens are normalized to underscores. Both syntax forms are accepted.
40
+ - Values are parsed with Python literal syntax when possible.
41
+
42
+ Examples:
43
+
44
+ ```bash
45
+ safellm4se-sample --evaluator safellm4se.sampling.myevaluators.random_binary_evaluator -- success_probability=0.7
46
+ safellm4se-sample --evaluator safellm4se.sampling.myevaluators.random_normal_evaluator -- --mean=50 --standard-deviation=20
47
+ safellm4se-sample --evaluator safellm4se.sampling.myevaluators.groq.random -- temperature=0.2 model_id="openai/gpt-oss-20b"
48
+ ```
49
+
50
+ Generated files in `--output-dir`:
51
+
52
+ | File | Description |
53
+ |---|---|
54
+ | `measurements.csv` | All completed observations. |
55
+ | `.sampling.lock` | Interprocess lock file. |
56
+ | `.sampling_reservations.json` | In-progress execution reservations. |
57
+ | `logs/log_<timestamp>.log` | Execution log. |
58
+
59
+ `measurements.csv` core columns:
60
+
61
+ | Column | Meaning |
62
+ |---|---|
63
+ | `date`, `time` | Local timestamp when the observation was persisted. |
64
+ | `task_id` | Task identifier passed or auto-generated by the sampler. |
65
+ | `experiment_name` | Evaluator experiment name. |
66
+ | `model_name` | Human-readable model or provider label. |
67
+ | `model_id` | Provider-specific model identifier. |
68
+ | `execution_number` | Sequential run number for the task/experiment/model key. |
69
+ | `prompt_tokens` | Prompt tokens consumed by the observation. |
70
+ | `completion_tokens` | Completion tokens consumed by the observation. |
71
+ | `total_tokens` | Total tokens consumed by the observation. |
72
+ | `theta` | Numeric evaluation value. |
73
+ | `metric_type` | `binary` or `continuous`. |
74
+ | `evaluator` | Evaluator class name. |
75
+ | `evaluator_parameters` | JSON-serialized constructor parameters. |
76
+ | `run_id` | UUID of the sampler process run. |
77
+
78
+ Non-reserved evaluator parameters are also written as extra CSV columns.
79
+
80
+ ## `safellm4se-report`
81
+
82
+ Purpose: summarize all measurements for the sample identified by `task_id` and generate optional visualizations.
83
+
84
+ ```bash
85
+ safellm4se-report --input output/measurements.csv --task-id TASK_ID [options]
86
+ ```
87
+
88
+ Options:
89
+
90
+ | Option | Default | Description |
91
+ |---|---:|---|
92
+ | `--input FILE_NAME` | Required | CSV generated by `safellm4se-sample`. |
93
+ | `--output FILE_NAME` | `report.csv` | Output CSV report. |
94
+ | `--task-id TASK_ID` | Required | Task identifier to summarize. |
95
+ | `--task-name NAME` | None | Plot display name. |
96
+ | `--confidence-level` | `0.95` | Confidence level as a fraction in `(0, 1)`. |
97
+ | `--ci-method` | `auto` | Continuous CI method: `auto`, `t`, or `bootstrap`. Binary metrics always use Wilson. |
98
+ | `--boxplot FILE_NAME` | None | Optional SVG boxplot. |
99
+ | `--violin FILE_NAME` | None | Optional SVG violin plot. |
100
+ | `--ecdf`, `--ECDF FILE_NAME` | None | Optional SVG empirical CDF. |
101
+ | `--raincloud FILE_NAME` | None | Optional SVG raincloud plot. |
102
+ | `--kde`, `--KDE FILE_NAME` | None | Optional SVG kernel density plot. |
103
+ | `--verbose` | `False` | Print INFO and higher logs to the console. |
104
+ | `--log LEVEL` | Disabled | Print logs from `DEBUG`, `INFO`, `WARNING`, `ERROR`, or `CRITICAL`. |
105
+ | `--h` | | Show help. |
106
+
107
+ Output columns stored in the output CSV report:
108
+
109
+ | Column | Meaning |
110
+ |---|---|
111
+ | `date`, `time` | Report generation timestamp. |
112
+ | `task_id` | Summarized task identifier. |
113
+ | `model_name`, `model_id`, `temperature` | Constant model/configuration fields validated across rows. |
114
+ | `N` | Number of observations. |
115
+ | `prompt_tokens`, `completion_tokens`, `total_tokens` | Aggregated token usage. |
116
+ | `theta_mean`, `theta_median`, `theta_min`, `theta_max` | Quality summary. |
117
+ | `theta_type` | Inferred or declared metric type. |
118
+ | `sd` | Sample standard deviation. |
119
+ | `cv` | Coefficient of variation in percent. |
120
+ | `iqr`, `q1`, `q3` | Interquartile range and quartiles. |
121
+ | `ci_method` | Selected CI method. |
122
+ | `ci_confidence-level` | Confidence level in percent. |
123
+ | `ci_low`, `ci_high`, `ci_width` | Confidence interval bounds and total width. |
124
+
125
+ ## `safellm4se-compare`
126
+
127
+ Purpose: compare two samples identified by `task_id-1` and `task_id-2` in the same
128
+ CSV input file. The comparison can be either *paired* or *independent*.
129
+ It also generates optional visualizations comparing the two samples.
130
+
131
+ ```bash
132
+ safellm4se-compare --input output/measurements.csv --task-id-1 TASK_A --task-id-2 TASK_B --test-type independent
133
+ ```
134
+
135
+ Options:
136
+
137
+ | Option | Default | Description |
138
+ |---|---:|---|
139
+ | `--input FILE_NAME` | Required | CSV generated by `safellm4se-sample`. |
140
+ | `--output FILE_NAME` | `compare.csv` | Output CSV comparison report. |
141
+ | `--task-id-1 TASK_ID` | Required | First task identifier. |
142
+ | `--task-name-1 NAME` | None | First display name for plots. |
143
+ | `--task-id-2 TASK_ID` | Required | Second task identifier. |
144
+ | `--task-name-2 NAME` | None | Second display name for plots. |
145
+ | `--test-type` | Required | `paired` or `independent`. |
146
+ | `--confidence-level` | `0.95` | Bootstrap confidence level as a fraction in `(0, 1)`. |
147
+ | `--boxplot FILE_NAME` | None | Optional two-sample SVG boxplot. |
148
+ | `--violin FILE_NAME` | None | Optional two-sample SVG violin plot. |
149
+ | `--ecdf`, `--ECDF FILE_NAME` | None | Optional two-sample SVG empirical CDF. |
150
+ | `--raincloud FILE_NAME` | None | Optional two-sample SVG raincloud plot. |
151
+ | `--kde`, `--KDE FILE_NAME` | None | Optional two-sample SVG kernel density plot. |
152
+ | `--verbose` | `False` | Print INFO and higher logs to the console. |
153
+ | `--log LEVEL` | Disabled | Print logs from `DEBUG`, `INFO`, `WARNING`, `ERROR`, or `CRITICAL`. |
154
+ | `--h` | | Show help. |
155
+
156
+ Comparison protocol (how statistics are computed) depends on the design type:
157
+
158
+ | Design | Test | CI | Effect size |
159
+ |---|---|---|---|
160
+ | `independent` | Mann-Whitney U | Bootstrap CI for the mean difference | Cliff's delta |
161
+ | `paired` | Wilcoxon signed-rank | Paired bootstrap CI for the mean difference | Matched-pairs rank-biserial correlation |
162
+
163
+ For paired comparisons, both tasks must contain exactly the same
164
+ `execution_number` values. The comparison aligns rows by that field.
165
+
166
+ Effect size magnitude thresholds:
167
+
168
+ | Absolute effect size | Magnitude |
169
+ |---:|---|
170
+ | `< 0.147` | `negligible` |
171
+ | `>= 0.147` | `small` |
172
+ | `>= 0.33` | `medium` |
173
+ | `>= 0.474` | `large` |
174
+
175
+ The estimated difference is computed as:
176
+
177
+ ```text
178
+ theta_mean_1 - theta_mean_2
179
+ ```
180
+
181
+ Optional visualizations are generated with the same names as in `safellm4se-report`,
182
+ but they show both samples side by side.