Files
2026-11-16 16:54:12 +01:00

119 lines
9.6 KiB
Markdown

# AI model testing project plan
## Goal
Build a self-hosted tool for evaluating chat/text models served by a llama.cpp server through an OpenAI-compatible API. It should support both a command-line interface and a local dashboard. The first user is one person running it in a Linux LXC container on Proxmox, with room to support a team later. The testing LXC is expected to have about 8 CPU cores and 8 GB RAM. The tested-model LXC has access to an RTX 3060 with 12 GB VRAM and about 128 GB system RAM; its API is reachable over the network.
The tool should compare different models on the same cases and track changes to one model's inference settings over time. It should combine personal test cases, selected public benchmarks, automatic scoring, model-based judging, and human review.
## Core principles
- Store each test case and run configuration in a reproducible format.
- Preserve raw requests, responses, errors, timing, scores, and scorer versions.
- Keep quality evaluation separate from performance/load measurement.
- Show individual cases behind aggregate scores. Never reduce a model to one opaque number. Allow each model profile to select relevant suites, while keeping common suites for fair cross-model comparisons.
- Make the runner usable without the dashboard; both use the same database and evaluation logic.
- Treat model-based judging as an opinion that can be inspected and overridden by human review.
## Proposed architecture
1. **Test definitions:** Versioned YAML or JSON files for suites and cases. A case includes messages, category/tags, expected behavior, scoring rules, and optional benchmark provenance.
2. **Model configurations:** Named endpoint, model identifier, sampling parameters, context settings, and any relevant server metadata. Credentials live outside test definitions.
3. **Runner:** A Python CLI sends requests to the OpenAI-compatible chat endpoint, applies timeouts and retries, and writes immutable run records to SQLite.
4. **Scoring:** Pluggable deterministic checks (exact/normalized match, required or forbidden content, JSON/schema checks), a separately configured local CPU judge with versioned rubrics, and human scores with notes. The judge runs in a separate Docker container on the model LXC. Judge work runs after the tested-model run, with GPU access disabled and resource limits set, so it does not distort performance measurements.
5. **Dashboard:** A LAN-only web app reads the same run database. It shows run summaries, filters, side-by-side responses, score breakdowns, performance distributions, and a review queue. Design an authentication boundary for future remote access, but defer login and internet exposure.
6. **Benchmark import:** Adapters turn selected public datasets into the project's case format while preserving dataset name, version, split, license, and original item ID.
Python is a practical default because it can serve the CLI, evaluator, and dashboard backend. SQLite is adequate for a personal installation; a database abstraction can allow a larger database later. Choose the dashboard framework during implementation after a small prototype, keeping the runner independent of it.
## Measurements
| Area | First measurements | Interpretation |
| --- | --- | --- |
| Correctness | Pass rate by suite/category; exact or normalized match; structured-output validity | Only compare cases with compatible scoring rules. |
| Subjective quality | Judge rubric score and explanation; human score and notes | Keep both scores visible; do not silently combine them. |
| Reliability | Request success rate, timeouts, invalid responses, retry count | Report original failures as well as eventual success. |
| Latency | Total elapsed time; time to first token when streaming is supported | Use repeated runs and distributions, not one sample. |
| Throughput | Generated tokens per second when token counts are available | Record whether counts came from the server or local estimation. |
| Resource use | Optional host/server CPU, memory, and GPU metrics | Add only when collection is feasible in the Proxmox setup. |
| Cost | Optional estimated energy or external API cost | Local-model cost requires assumptions; do not present it as directly measured. |
## Run types
- **Quality run:** Fixed cases and settings, usually low concurrency. Preserve prompt order, random seed when supported, and repeated samples for nondeterministic cases.
- **Performance run:** Warm-up plus repeated requests under a stated concurrency level. Report median and tail latency, throughput, and errors. Record server load and hardware metadata when possible.
- **Judge run:** Score saved responses independently so judge prompts/models can be changed without rerunning the tested model.
- **Review session:** A human scores or annotates saved responses, preferably with model names hidden when practical.
## Milestones
### 1. Runnable vertical slice
- CLI configuration for one llama.cpp endpoint and one model.
- A small, balanced hand-written starter suite: instruction following, reasoning/math, and practical writing/summarization. Add coding and structured-output suites as soon as their scorers are ready. Each model profile can opt into relevant suites.
- Save complete run data in SQLite and export a JSON report.
- Deterministic scoring and clear handling of errors/timeouts.
- **Done when:** A run can be repeated and its individual requests and scores inspected locally.
### 2. Comparisons and performance
- Run the same suite against several model/settings profiles.
- Add repetitions, warm-up, latency distributions, token throughput, and concurrency controls.
- Compare two runs case by case and highlight regressions.
- **Done when:** The CLI can answer which cases improved or regressed and how performance changed under a documented test setup.
### 3. Dashboard and review
- Run list and summary; suite/category filters; response comparison; failure details.
- Human review queue with scores, notes, and review status.
- Judge-model scoring with versioned rubric and recorded rationale.
- **Done when:** A user can investigate a failed case and review subjective outputs without querying the database directly.
### 4. Benchmark imports and operations
- Import small, fixed subsets of public benchmark cases with provenance and licensing information. Start with IFEval for verifiable instruction following and GSM8K for math reasoning. Consider MMLU-Pro for broader knowledge/reasoning and LiveCodeBench only after a safe code-execution harness exists. Keep benchmark scores separate from personal-suite scores.
- Add backup/export, basic authentication if exposed beyond localhost, and deployment instructions for the LXC container.
- Document how to change the model, update test suites, and reproduce a comparison.
- **Done when:** A fresh LXC installation can run the supplied example suite and import a benchmark subset.
## Suggested initial repository layout
```text
src/
model_tester/
cli.py
client.py
runner.py
scoring/
storage/
dashboard/
suites/
examples/
benchmarks/
tests/
docs/
```
## Decisions to settle before implementation
1. Start judge-model calibration with [Qwen3-4B-Instruct-2507](https://huggingface.co/Qwen/Qwen3-4B-Instruct-2507) in a Q4_K_M GGUF (about 2.5 GB model file). It is a 4B non-thinking instruction model. Reserve about 6-8 GB RAM for the CPU judge initially, use a 4K-8K context limit, and adjust after measuring. On the E5-2697 v4 host, a rough, unverified single-request estimate is 8-18 generated tokens/second; actual speed depends on memory channels, NUMA placement, context, CPU contention, and quantization. Select or replace the judge with a calibration set scored by hand, then measure agreement and speed. Keep the judge model configurable.
2. Confirm the test LXC's storage allowance and whether the model LXC can expose hardware metrics. Neither blocks the first milestone.
3. Choose fixed benchmark versions, subsets, prompts, and scoring rules before comparing runs. Published benchmark questions may have appeared in model training data, so use personal cases alongside them.
4. Identify a few real tasks for each model over time. The balanced starter suite is a placeholder until those tasks are known.
5. Set retention rules after observing actual run size. SQLite and the dashboard remain the main interface; JSON export is sufficient for backups and debugging in the first release.
## Benchmark candidates and selection rules
| Candidate | Why include it | First-release treatment |
| --- | --- | --- |
| [IFEval](https://huggingface.co/datasets/google/IFEval) | Verifiable instruction-following prompts; official data is Apache 2.0. | Import a pinned subset and use the benchmark's checks where feasible. |
| [GSM8K](https://huggingface.co/datasets/openai/gsm8k) | Math word problems with numeric final answers; official dataset is MIT licensed. | Import a pinned test subset and score extracted final answers. |
| [MMLU-Pro](https://huggingface.co/datasets/TIGER-Lab/MMLU-Pro) | Broader multiple-choice knowledge and reasoning. | Later, after the first two imports are validated. |
| [LiveCodeBench](https://github.com/LiveCodeBench/LiveCodeBench) | Coding evaluation with executable tests. | Later; requires isolated code execution and a faithful evaluation protocol. |
For any import, record the source URL, revision, split, selected item IDs, license, prompt template, and scorer version. Do not present a small subset score as an official benchmark score.
## First implementation task
Create three to five representative cases and one model profile, then build the CLI-to-database vertical slice. Use actual run output to refine the case schema and dashboard requirements before adding broader benchmark coverage.