# METHOD — MiniCPM5-2B-0822 via API

## Project Goal

This project measures how reliably MiniCPM5-2B can turn focused prompts into small, inspectable mobile UI proofs through a repeatable generation and browser-smoke-test loop.

The outputs are proofs and artifacts, not finished products. They are not all fully functional products, and a passing record does not prove semantic feature correctness, completeness, visual quality, or production readiness. It shows what the model produced and what the automated checks could observe.

## What Was Run

- Model endpoint: `MiniCPM5-2B-0822` through an OpenAI-compatible `POST {BASE}/chat/completions`.
- Credentials are local-only in `.env`; use `.env.example` as the template. `.env` is intentionally not tracked.
- Generation uses `chat_template_kwargs: {"enable_thinking": false}`. This is the provider control that produced no hidden reasoning in the tested endpoint; a top-level `enable_thinking` field was not sufficient.
- Default controlled settings: temperature `0.2`, top-p `0.9`, max tokens `6000`, up to `3` attempts. Settings can be overridden on the command line. These settings apply only to runs produced by the current runner; historical records do not preserve them.
- The first attempt uses the full master prompt. A failed candidate receives either a browser-error repair prompt or a smaller compact prompt. Retries do not replace an existing build unless the candidate passes.

## Automated Acceptance

A candidate is accepted only when all of these pass:

- Complete HTML document with closing `</html>`.
- Balanced script tags and no trailing output after the document.
- The API response stopped normally, unless the run is explicitly mock mode.
- Viewport metadata and at least one button are present.
- Chromium can load it at `390x844` through a temporary local HTTP server.
- Chromium captures no page errors, console errors, request failures, or failed HTTP responses.
- The document has no horizontal overflow.
- Every visible, enabled `<button>` is clicked once by the smoke test.

This is an automated artifact/runtime gate. It does not verify that a button performs the requested semantic task, that output quality is correct, or that the design is visually good.

## Metrics

- `request_s`: end-to-end non-streaming API response time. It is not TTFT.
- `prompt_toks`, `completion_toks`, `total_toks`: provider-reported token counts for the accepted generation when available.
- `reasoning_toks`: provider-reported hidden reasoning count. `0` is recorded only when the provider reports zero; unknown remains unknown.
- `toks_per_s`: accepted completion tokens divided by `request_s`. It is not decoder throughput.
- `runtime_pass`: the Chromium smoke gate passed.
- `contract_pass`: all static contract heuristics passed. This is not a visual-quality score.
- `feature_correctness_status`: remains `not_measured`; there are no per-task assertions or human labels in this project.

## Reproduction

- Generate selected builds: `python scripts/run_2b.py --ids 001 016`.
- Validate existing files without an API call: `python scripts/run_2b.py --validate-only`.
- Explicit mock testing only: `python scripts/run_2b.py --mock --ids 001`.
- Capture posters: `python scripts/shots.py`.
- Aggregates are written to `data/benchmark.json` and `docs/BENCHMARK.md`.
