Add measured SmolLM2 syntax reviewer and Member 1 evidence
myfileagent-python-ci/pipeline/head This commit looks good
myfileagent-python-ci/pipeline/head This commit looks good
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
# Member 1 runtime contract
|
||||
|
||||
This is a **real** SmolLM2-135M-Instruct run. The model proposes text; the reviewer accepts only the specified one-character repair. The original source remains untouched. The only model-output cleanup is removal of surrounding spaces/tabs/newlines, followed by restoration of the source's final-newline policy. The unmodified stdout is saved as `raw_response.txt`.
|
||||
|
||||
## Identity and inputs
|
||||
|
||||
- Base model: `HuggingFaceTB/SmolLM2-135M-Instruct`, revision `12fd25f77366fa6b3b4b768ec3050bf629380bac`, Apache-2.0. [Official model card](https://huggingface.co/HuggingFaceTB/SmolLM2-135M-Instruct).
|
||||
- Third-party quantization: `QuantFactory/SmolLM2-135M-Instruct-GGUF`, revision `476854d00ede130660aba430d15f9347ad2e7d0e`, `SmolLM2-135M-Instruct.Q4_0.gguf`, 91,726,912 bytes, SHA-256 `f68203bfb98b1b1e8c64fac75fab10c4e36acac081609573b4df0fcc19c90dd9`. [Artifact repository](https://huggingface.co/QuantFactory/SmolLM2-135M-Instruct-GGUF).
|
||||
- Runtime: official [llama.cpp release b12785](https://github.com/ggml-org/llama.cpp/releases/tag/b12785), source commit `55d482814bb3b985daa7bfa175c6d628fc27beac`; Ubuntu x64 archive SHA-256 `c52fdce909b3e55b2e763e9a8b08b2b006281ebc5b5c6c8ea91e5d2075c8fd27`. Entrypoint `llama-completion` on Linux amd64 CPU.
|
||||
- Python 3.12+ standard library. Runtime also requires `libgomp.so.1`. The measured local setup used Ubuntu `libgomp1` version `14.2.0-4ubuntu2~24.04.1`, package SHA-256 `e8a95ec58125b4933597f30ff56c2ae10edf90f287262e366d4b6edea3019144` extracted under `/tmp`; it was not installed on the host. Member 2's execution image should include a pinned compatible `libgomp1`.
|
||||
- Exact settings and prompt are in [model-lock.json](../../reviewer/model-lock.json): context 64, batch and microbatch 32, one thread, eight maximum generated tokens, temperature 0, seed 1, stop at newline.
|
||||
|
||||
## Setup and CLI
|
||||
|
||||
From the repository root, with outbound HTTPS for the two public artifacts:
|
||||
|
||||
```sh
|
||||
python3 -m reviewer.prepare_runtime --dest /tmp/ssw590-member1-runtime
|
||||
```
|
||||
|
||||
In an image with `libgomp1` already installed:
|
||||
|
||||
```sh
|
||||
export REVIEWER_MODEL_PATH=/tmp/ssw590-member1-runtime/SmolLM2-135M-Instruct.Q4_0.gguf
|
||||
export REVIEWER_LLAMA_COMPLETION=/tmp/ssw590-member1-runtime/llama-b12785/llama-completion
|
||||
SHA=$(git rev-parse HEAD)
|
||||
python3 -m reviewer --input tests/fixtures/demo_broken.py --source-commit "$SHA" --out-dir /tmp/ssw590-review-001
|
||||
python3 tests/smoke_demo.py /tmp/ssw590-review-001/reviewed.py
|
||||
```
|
||||
|
||||
Choose a **new** output directory each time. If `libgomp1` is not on the host, set `LD_LIBRARY_PATH` to a compatible extracted library directory. Do not set `REVIEWER_BACKEND_COMMAND` for a live run: that override is exclusively for deterministic fixtures and labels the output `mode=fixture`. Already-valid source runs without a model and uses `mode=bypass`.
|
||||
|
||||
The adapter hashes the model before inference. It runs a fixed executable and fixed arguments; it never runs model-generated commands. It parses llama.cpp's `common_perf_print` prompt-token and sampler-total counters. For b12785, output tokens are `sampler_total_tokens - prompt_eval_tokens`; the probe agreed with the server API's `predicted_n=5`. If either counter is absent, JSON count is `null`. The raw response and the counter lines are saved with each review.
|
||||
|
||||
## Whole-workload measurement
|
||||
|
||||
The measured container was `python@sha256:ae14d4ce8771606477a81446e7ef429edd6762305fc50c84507c1041fa8285d1`. It used Docker cgroup v2, `--network none`, `--cpus 1`, no swap, and the full reviewer plus its llama.cpp child. A private copy of the GGUF was placed on container tmpfs before inference so its pages were charged to the same cgroup; `memory.peak` includes cgroup-charged file cache. The three fresh-process trials used a 400,000,000-byte ceiling to reveal natural peaks; a fourth verified the 250,000,000-byte hard cap. Exact bundles and resource records are under `evidence/`.
|
||||
|
||||
To reproduce one strict run on this host after preparation (the following assumes the extracted `libgomp1` directory shown here):
|
||||
|
||||
```sh
|
||||
mkdir -p /tmp/ssw590-member1-runtime/container-out
|
||||
# Choose a fresh container name and /out/ directory each time.
|
||||
docker run --name ssw590-member1-recheck --network none \
|
||||
--memory 250000000 --memory-swap 250000000 --cpus 1 --pids-limit 64 \
|
||||
--read-only --tmpfs /tmp:rw,noexec,size=128m \
|
||||
--user "$(id -u):$(id -g)" \
|
||||
-v "$PWD:/src:ro" -v /tmp/ssw590-member1-runtime:/runtime:ro \
|
||||
-v /tmp/ssw590-member1-runtime/container-out:/out:rw -w /src \
|
||||
-e PYTHONDONTWRITEBYTECODE=1 -e REVIEWER_MODEL_PATH=/tmp/model.gguf \
|
||||
-e REVIEWER_LLAMA_COMPLETION=/runtime/llama-b12785/llama-completion \
|
||||
-e LD_LIBRARY_PATH=/runtime/libgomp-root/usr/lib/x86_64-linux-gnu:/runtime/llama-b12785 \
|
||||
python@sha256:ae14d4ce8771606477a81446e7ef429edd6762305fc50c84507c1041fa8285d1 \
|
||||
sh -c 'cp /runtime/SmolLM2-135M-Instruct.Q4_0.gguf /tmp/model.gguf; python3 -m reviewer --input tests/fixtures/demo_broken.py --source-commit 5373351a7e7ac2bc0f34bae19c25383de3843ca7 --out-dir /out/recheck; result=$?; echo review_exit=$result; cat /sys/fs/cgroup/memory.peak; cat /sys/fs/cgroup/memory.events; exit $result'
|
||||
docker inspect ssw590-member1-recheck --format 'exit={{.State.ExitCode}} oom={{.State.OOMKilled}} limit={{.HostConfig.Memory}} swap={{.HostConfig.MemorySwap}}'
|
||||
```
|
||||
|
||||
`--memory-swap` equal to `--memory` disables additional swap. The command includes the temporary copy step in the cgroup; a normal production image may mount a preexisting model instead. Member 2 must repeat a memory check in the actual Actions image/runner before claiming that environment also meets the target.
|
||||
|
||||
## Results and limits
|
||||
|
||||
| Run | Natural/strict peak bytes | Elapsed seconds | Input/output tokens | Outcome |
|
||||
| --- | ---: | ---: | ---: | --- |
|
||||
| Trial 1, 400 MB ceiling | 236,150,784 | 3.848678 | 23 / 5 | corrected, no OOM |
|
||||
| Trial 2, 400 MB ceiling | 233,103,360 | 3.941480 | 23 / 5 | corrected, no OOM |
|
||||
| Trial 3, 400 MB ceiling | 238,735,360 | 1.812362 | 23 / 5 | corrected, no OOM |
|
||||
| Acceptance, 250 MB cap | 234,405,888 | 3.392288 | 23 / 5 | corrected, no OOM, smoke passed |
|
||||
|
||||
This is measured local feasibility for the controlled fixture, not proof of arbitrary Python repair or Actions/Jenkins deployment. An initial interactive CLI returned unrelated code. A one-shot server variant peaked at 261,754,880 bytes with a private model copy under a 400 MB ceiling; a default-batch completion trial also exceeded the target. These failed experiments are retained under `evidence/experiments/`.
|
||||
Reference in New Issue
Block a user