> ## Documentation Index
> Fetch the complete documentation index at: https://docs.joinbase.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# PRISM challenge operators

> Challenge-operator guide for PRISM (not BASE subnet validator mint): local validation, runtime config, data plane, compute budget, LLM gate.

This guide is for **PRISM challenge operators** (running the PRISM service). It is not the BASE subnet validator pack under Validators. This guide covers local validation and production-oriented configuration for running PRISM as a BASE challenge.

*Source: `docs/operators.md:1-5`.*

## Installation

```bash theme={"dark"}
git clone https://github.com/BaseIntelligence/prism.git
cd prism
uv sync --frozen --extra dev
```

*Source: `docs/operators.md:6-12` (repo URL per `SOURCES.md:51`).*

## Local validation

```bash theme={"dark"}
.venv/bin/ruff check src
.venv/bin/mypy src/prism_challenge/evaluator
.venv/bin/python -m pytest tests -q
```

*Source: `docs/operators.md:14-20`.*

## Required runtime configuration

At minimum, PRISM needs a database URL, a shared-token file, and an execution backend:

```bash theme={"dark"}
PRISM_DATABASE_URL=sqlite+aiosqlite:////data/prism.sqlite3
PRISM_SHARED_TOKEN_FILE=/run/secrets/platform/challenge_token
PRISM_EXECUTION_BACKEND=platform_gpu
```

The shared token must match the token configured in the master for this challenge.

*Source: `docs/operators.md:22-32`.*

## Docker broker configuration

Production evaluation uses the Docker broker with the augmented evaluator image:

```bash theme={"dark"}
PRISM_DOCKER_ENABLED=true
PRISM_DOCKER_BACKEND=broker
PRISM_DOCKER_BROKER_URL=http://platform-docker-broker:8082
PRISM_DOCKER_BROKER_TOKEN_FILE=/run/secrets/platform/challenge_token
PRISM_PLATFORM_EVAL_IMAGE=<deployment-specific evaluator image>
PRISM_PLATFORM_EVAL_GPU_COUNT=1
PRISM_DOCKER_NETWORK=none
```

<Tip>
  Set `PRISM_PLATFORM_EVAL_IMAGE` to the evaluator image published for your deployment. The image must ship `sentencepiece` and an offline tiktoken gpt2 cache so reference tokenizers load with no network.
</Tip>

The scored run is single-node and uses `torchrun --standalone --nnodes=1 --nproc-per-node=1`.

*Source: `docs/operators.md:34-50` (evaluator image literal omitted; it references a non-BASE registry - supply your own).*

## Locked FineWeb-Edu data plane

The broker bind-mounts the locked FineWeb-Edu data read-only into the eval container, which runs with `network=none`:

```bash theme={"dark"}
PRISM_PLATFORM_EVAL_DATA_DIR=/data/fineweb-edu/train       # miner-visible, read-only
PRISM_PLATFORM_EVAL_VAL_DATA_DIR=/data/fineweb-edu/val     # secret; scorer-only, never mounted into eval
PRISM_PLATFORM_EVAL_REFERENCE_TOKENIZER_DIR=/opt/reference-tokenizers
```

`HF_HUB_OFFLINE=1` and `HF_DATASETS_OFFLINE=1` are set inside the eval container. The `val`/`test` splits are secret and must never be exposed to a miner script.

*Source: `docs/operators.md:52-64`.*

## Compute budget

The score is compute-normalized; wall-clock is only a safety cap, enforced in layers:

```bash theme={"dark"}
PRISM_PLATFORM_EVAL_BUDGET_SECONDS=1200            # graceful stop; score the partial stream
PRISM_PLATFORM_EVAL_WATCHDOG_GRACE_SECONDS=120     # hard watchdog above the graceful budget
PRISM_PLATFORM_EVAL_TIMEOUT_SECONDS=1800           # outer docker/broker backstop
PRISM_PLATFORM_EVAL_ARTIFACTS_QUOTA_BYTES=2147483648
```

*Source: `docs/operators.md:66-75`.*

## LLM hard gate configuration

The OpenRouter LLM hard gate is enabled by default and reviews both scripts before any GPU work:

```bash theme={"dark"}
PRISM_LLM_REVIEW_ENABLED=true
PRISM_OPENROUTER_BASE_URL=https://openrouter.ai/api/v1
PRISM_OPENROUTER_MODEL=openai/gpt-4o
PRISM_OPENROUTER_API_KEY_FILE=/run/secrets/openrouter_api_key
```

A `reject` from the gate is terminal. The eval container carries no OpenRouter key (the gate runs host-side before the container is launched).

*Source: `docs/operators.md:77-89`; `config.example.yaml:60-63`.*

## Multi-GPU static contract

```bash theme={"dark"}
PRISM_DISTRIBUTED_CONTRACT_POLICY=reject     # reject | flag | off
PRISM_PLATFORM_EVAL_MAX_GPU_COUNT=8
```

`reject` (the default) hard-rejects a non-distributed `training.py`; `flag` advances but logs; `off` skips the check.

*Source: `docs/operators.md:91-99`.*

## Duplicate review

```bash theme={"dark"}
PRISM_PLAGIARISM_ENABLED=true
```

An exact-source-hash duplicate is rejected, and a borderline-similarity quarantine is folded into a terminal rejection at ingress. There is no operator hold-resolution surface.

*Source: `docs/operators.md:101-108`.*

## Running locally

```bash theme={"dark"}
PRISM_SHARED_TOKEN=dev-secret \
PRISM_DATABASE_URL=sqlite+aiosqlite:///./prism.sqlite3 \
.venv/bin/uvicorn prism_challenge.app:app --host 0.0.0.0 --port 8000
```

*Source: `docs/operators.md:110-116`.*

## Health checks

```bash theme={"dark"}
curl http://localhost:8000/health
curl http://localhost:8000/version
```

Internal weights require the shared token:

```bash theme={"dark"}
curl -H "Authorization: Bearer dev-secret" \
  -H "X-Platform-Challenge-Slug: prism" \
  http://localhost:8000/internal/v1/get_weights
```

*Source: `docs/operators.md:124-137`.*

## Deployment

In a deployment, PRISM registers as a challenge image reached by the master over the internal challenge network. Public miner traffic goes through the proxy, which verifies signatures and forwards to PRISM. Weights are exposed only via `get_weights` and are always dry-run.

*Source: `docs/operators.md:118-122`.*

## Troubleshooting

| Symptom                              | Likely cause                                                                                  |
| ------------------------------------ | --------------------------------------------------------------------------------------------- |
| `invalid internal token`             | Shared token mismatch between the master and PRISM                                            |
| submission rejected before container | Static sandbox, two-script contract, param cap, distributed contract, or LLM hard-gate reject |
| submission held                      | LLM review quarantine (transient error or ambiguous verdict)                                  |
| evaluation failed                    | Broker, image, GPU, timeout, missing locked data, or container error                          |
| empty weights                        | No completed, scored submissions yet                                                          |
| `missing_locked_data`                | The read-only FineWeb-Edu train mount is absent or empty on the GPU node                      |

*Source: `docs/operators.md:139-148`.*
