This repo is documentation- and schema-first so humans and coding agents can operate from docs/, YAML configs, and JSON outputs without reverse-engineering every module.
marfago-labs/
ner-gold-generator/ # build gold JSONL
ner-dataset/ # committed benchmark artifacts (datasets/*.jsonl)
ner-detector/ # this repo — backends + benchmarks
Dataset path resolution (in order): absolute benchmark_root in YAML → NER_DATASET_DIR env (folder containing *.jsonl or its parent datasets/) → sibling ../ner-dataset → in-repo checkout ner-dataset/ (CI layout).
.env)Never commit .env. Copy .env.example → .env only when using live OpenRouter.
| Task | Variables |
|---|---|
| Smoke benchmark, pattern NER, PR CI | None |
| ML benchmark (local) | Optional HF_TOKEN |
| Live LLM NER / LLM benchmark runs | OPENROUTER_API_KEY (+ uv sync --extra llm) |
cp .env.example .env
# OPENROUTER_API_KEY=... # https://openrouter.ai/keys
Details: configuration.md. GitHub Actions: ci.md.
.env or API keys. Gitleaks runs in CI and pre-commit.backend: pattern, provider: mock, MOCK_LLM=true, or scripts/agent_smoke.py.uv sync --extra ml --extra gliner; CI does not download models on every PR.| Artifact | Location |
|---|---|
| Gold JSONL schema | ner-gold-generator gold-schema.md |
| Benchmark config | benchmark/config/compare_backends.yaml |
| Label normalization | benchmark/config/label_maps.yaml |
| Metrics output | {output_dir}/metrics.json after run_benchmark.py |
| Doc F1 semantics | ADR 001, benchmarks.md |
CLI flags → config/ner.yaml → config/default_models.yaml catalog defaults.
No API keys, no ML download:
cd ner-detector
uv sync --extra dev
uv run python scripts/agent_smoke.py
Prints JSON to stdout: {"ok": true, "output_dir": "...", "metrics_json": "..."}.
Equivalent manual command:
uv run python benchmark/run_benchmark.py --pattern-only --datasets arxiv_gold --max-examples 2 --no-curves
Requires sibling ner-gold-generator:
cd ner-gold-generator
uv sync --extra dev
uv run build-gold --source synthetic \
--synthetic-config configs/synthetic_smoke.yaml \
--output /tmp/synthetic_smoke.jsonl
Point NER_DATASET_DIR at the output directory (or copy into ner-dataset/datasets/), then run recipe 1.
| Context | Behavior |
|---|---|
| PR CI (ci.yml) | Gitleaks + pytest with mocks; checks out ner-dataset into workspace |
| Benchmark Pages (benchmark-pages.yml) | Full ML/LLM run on master; optional OPENROUTER_API_KEY |