rulechef-live / README.md
adaamko's picture
Restore the static page (no cpu-basic quota for Gradio)
27e064c verified
|
Raw History Blame Contribute Delete
2.45 kB
---
title: RuleChef Live
colorFrom: gray
colorTo: blue
sdk: static
app_file: index.html
license: apache-2.0
short_description: Model answers become regex rules as a stream plays
models:
- vllm-sr/vela3-fast
datasets:
- mattmdjaga/text-anonymization-benchmark-train
---
# RuleChef Live
A request stream where a teacher model's answers become labelled examples and
[RuleChef](https://github.com/KRLabsOrg/rulechef) turns them into regex rules. Rules answer the requests they cover, with no model
call; the teacher ([vllm-sr/vela3-fast](https://huggingface.co/vllm-sr/vela3-fast)) answers the rest.
- Task: dates and times, codes and reference numbers, and quantities in sentences from European Court of Human Rights judgments
(TAB, public train split).
- Rule learning: RuleChef search synthesis (`synth="search"`, no LLM), re-run on CPU after the first 50 labelled examples and then every 100 new ones.
- The page replays one offline run of `sim.py` (`data/replay.json`). The rules run live in the browser (`engine.js`, a port of
RuleChef's executor and of the gate); the teacher does not run on this static page.
## Files
- `index.html`, `app.js`, `style.css`: the page. `engine.js`: rule execution and gate in the browser.
- `cascade.py`: gate, rule execution (RuleChef's executor), scoring. `sim.py`: the stream run that writes `data/replay.json`.
- `prep.py`, `run_teacher.py`, `teacher_core.py`: how the requests and the teacher's answers in `data/requests.jsonl` were made.
- `pyref.py`, `verify_engine.js`: check that `engine.js` gives the same spans and gate decisions as the Python code.
Reproduce (Python 3.12; `torch` CPU, `transformers==5.17.0`, `pyarrow`, and RuleChef from
`git+https://github.com/KRLabsOrg/rulechef@8173f96f1b48cf1d66b35bc5ebe9d83be962a610`), in a fresh folder `work/`:
`python prep.py <TAB parquet> work`; run `run_teacher.py` over `work/requests.jsonl` into `work/teacher.jsonl`;
`python sim.py work work/replay.json`.
## Licences
- Code in this Space: Apache-2.0.
- RuleChef: Apache-2.0. vela3-fast: Apache-2.0.
- TAB (Text Anonymization Benchmark, Pilán et al. 2022, Norsk Regnesentral): MIT, notice in `DATA_LICENSE_TAB.txt`.
`data/requests.jsonl` holds sentences from its train split
([mattmdjaga/text-anonymization-benchmark-train](https://huggingface.co/datasets/mattmdjaga/text-anonymization-benchmark-train)
@`f0b7eeb`), with TAB's labels for the three types and the teacher's answers.