fix: broaden JSON answer extraction for model formatting variations
Snider+1: Virgil
fec46f3
Models output answers in several formats:
{"answer": "Y"} — standard (handled)
["answer": "Y"] — bracket variant (new)
{\n"answer": "Y"\n} — multiline (new)
"Y" — bare answer (new)
The regex now handles brackets, optional quotes on key,
and whitespace. Fallback checks for bare Y/N/TRUE/FALSE
answers when JSON isn't present.
Fixes ~388 Q4_K_M / ~62 BF16 no_json false positives in
the toxigen farm data.
Co-Authored-By: Virgil <virgil@lethean.io>
feat: expand toxigen to full 9,900-prompt HF dataset
Snider+1: Virgil
a3cc247
Replaced curated 50-question subset with complete toxigen/toxigen-data
(annotated split). 27 target groups, rich metadata (intent, framing,
stereotyping, factual, lewd, toxicity_human, toxicity_ai).
9,900 prompts × 8 rounds × 2 models = 158,400 data points for the
silent exit research. Each prompt carries its target_group for
per-category refusal rate analysis.
Also fixes samples_start wrap-around for continuous farming.
Co-Authored-By: Virgil <virgil@lethean.io>
fix: wrap toxigen samples_start past dataset end instead of crashing
Snider+1: Virgil
97a5fdf
The auto-offset progressed past the 50-question dataset, causing
'no items in range' → RuntimeError. Now wraps modulo dataset size
so the farm loops continuously through the question set.
Co-Authored-By: Virgil <virgil@lethean.io>
feat: ethical refusal as scored dimension, not failure
Snider+1: Virgil
967b785
Silent exits on toxic prompts now score as correct (the model correctly
identified toxicity and chose non-engagement). New 'ethical_refusal'
field in results. Scorecard shows Eth.Ref column (base/lek counts).
eval.py: exit_type='ethical_refusal' with hit=1 when gold=Y.
quick_eval.py: ethical_refusal=True scores 1.0 on toxic prompts.
Co-Authored-By: Virgil <virgil@lethean.io>
feat: generative toxigen eval with silent exit detection
Snider+1: Virgil
402c91a
eval.py now supports generative tasks (toxigen) alongside lighteval-backed
tasks (mmlu_pro). Generative tasks use Ollama's OpenAI API directly with
system prompts and structured JSON answers.
Silent exits (model opens thought channel then immediately EOS) are captured
as a distinct signal — not errors. LEK models exhibit pre-cognitive refusal
on prompts where engagement would propagate harm.
lem-eval.sh: LEM_TASK env var overrides the default task per worker.
quick_eval.py: bumped to 4096 max_tokens, system-prompted JSON answers.
Co-Authored-By: Virgil <virgil@lethean.io>
50-question generative evals for rapid A/B feedback:
- do_not_answer: safety refusal (does the model refuse harmful prompts?)
- gsm8k: math reasoning (correct numeric answer?)
- toxigen: toxicity (does the model avoid toxic continuation?)
- truthfulqa: truthfulness (correct vs incorrect answer content?)
Uses Ollama's OpenAI endpoint — works on both studio and charon.
No lighteval/logprobs dependency, pure generative scoring.
Usage:
uv run quick_eval.py --model hf.co/lthn/lemer:Q4_K_M --base hf.co/LetheanNetwork/lemer:Q4_K_M
Co-Authored-By: Virgil <virgil@lethean.io>
feat: add systemd service + timer, replaces cron watchdog
feat(eval): add LEM_NAMES filter for per-worker model selection
Snider+1: Virgil
3898f6c
Workers can now set LEM_NAMES=lemer to only farm specific models.
Comma-separated, None=all. Works alongside existing LEM_TYPES filter.
Co-Authored-By: Virgil <virgil@lethean.io>
feat(targets): re-add lemma/lemmy/lemrd full 6-variant slots (Phase 2 done)
Snider+1: Virgil
3e54ccf
The Phase 2 family rollout is complete — all three LetheanNetwork bases
now have their gguf (Q4_K_M / Q8_0 / BF16) and mlx (Q4 / 8bit / BF16)
quants uploaded, with paired lthn/* LEK-merged consumer repos.
Fleet is now at the documented target shape: 4 models × 6 variants =
24 paired A/B canons. Workers will pick up the new targets on their
next `lem-eval.sh maintain` cycle.
Co-Authored-By: Virgil <virgil@lethean.io>
fix: isolate per-target failures + temp park family until phase 2
Snider+1: Virgil
de0ced6
Two fixes after charon's loop died on a fail-fast target:
1. lem-eval.sh run_target now wraps 'uv run eval.py' so a single
target failure doesn't cascade through set -euo pipefail and
kill the outer loop. Logs the failure and continues to the
next target. Previously, one bad target (lemmy gguf with an
mlx-community base Ollama couldn't pull) was enough to nuke
the whole worker until the :07 watchdog restarted it.
2. targets.yaml temporarily drops the lemma/lemmy/lemrd rows
while Phase 2 of the family rollout is in progress (gguf +
mlx bases being converted and uploaded to LetheanNetwork/
right now). The full 24-row fleet returns at the end of
Phase 3 once every referenced base is pullable.
Co-Authored-By: Virgil <virgil@lethean.io>
fix(cron): add ~/.local/bin to PATH in lem-eval.sh
Snider+1: Virgil
97f1921
cron's default environment has a minimal PATH that does NOT include
~/.local/bin where uv is installed via its standalone installer. The
:07 watchdog fired correctly, started the loop, and lem-eval.sh
crashed on the first 'uv run' with 'command not found'. Cron'd
scripts have to handle their own PATH — fixing at the script level
so it works regardless of invocation context (cron, login shell,
manual ssh).
Co-Authored-By: Virgil <virgil@lethean.io>
fix(gguf): actually lazy-pull via /api/pull, fail loudly on probe
Snider+1: Virgil
de7952b
Two bugs the charon bring-up exposed:
1. Ollama's /v1/chat/completions does NOT lazy-pull missing models
When charon's cache was empty for Q4_K_M and Q8_0 (only BF16 was
pre-pulled), the first chat request returned 404. The wrapper
caught it as a generic Exception and returned empty text, which
lighteval processed as '?' extracted answers, and we committed
32 garbage rows (16 per quant, both sides '?' and zero hits)
to lthn/lemer and the lthn/LEM-benchmarks aggregator before the
wrapper bug was spotted.
2. The probe was defensive-to-a-fault
_probe() swallowed exceptions with a warning and 'continuing
anyway — Ollama may lazy-pull on first real request'. Since we
just learned Ollama doesn't lazy-pull, that assumption was
wrong, and the probe was silently covering up the failure.
Fixes:
- _ensure_cached() uses Ollama's native /api/pull endpoint to
actually pull missing models into the cache. Calls /api/tags
first to see if it's already there (chea…
fix(worker): continuous loop + cron as watchdog, not scheduler
Snider+1: Virgil
66ed84c
The worker is supposed to run back-to-back evals as a continuous daemon,
not wait for a cron trigger. My earlier install had it backwards — the
:07 cron ran one pass then exited, leaving the machine idle between
cron ticks. Inverting:
lem-eval.sh loop now runs 'once' in a tight loop with a 10s
breather between passes (enough to not thrash
logs / cron but short enough to stay busy).
Each 'once' iterates all runnable targets and
commit/pushes per target via run_target.
cron/submit.cron now a watchdog, not a scheduler. Runs at :07
hourly and resurrects the loop if it died.
No-op if the loop is still running.
cron/maintain.cron unchanged — :37 hourly git pull for config.
The 1h watchdog cadence means the worker can be dead for up to 1h
before being restarted. For the current MVP that's acceptable; if we
ever need tig…
cron: hourly cadence at :07 and :37 past the hour
Snider+1: Virgil
7e9482c
Align with the legacy LEM-benchmarks cron cadence already running on
charon (the old Ollama pipeline pushes at '7 * * * *'). Also bumping
the clone path assumption from $HOME/LEM-Eval to
$HOME/PycharmProjects/LEM-Eval to match the actual install location
lemmy uses on charon.
submit.cron 7 * * * * once per hour, flock-guarded against overlap
maintain.cron 37 * * * * git pull LEM-Eval + lem-benchmarks (~30 min
offset from submit so it doesn't race)
Co-Authored-By: Virgil <virgil@lethean.io>
fix: Pillow in PEP 723 deps + capture lighteval stderr on failure
Snider+1: Virgil
0600876
Two fixes that landed after the first charon smoke run:
1. Pillow missing from PEP 723 deps
lighteval's task registry eagerly imports every task module at
startup (to build the discovery table). tasks/mathvista.py does
'from PIL import Image' at module load time. When uv builds a
clean venv from just eval.py's deps, PIL isn't pulled in — it
was only present on studio via some transitive. Charon's fresh
venv exposed the gap. Adding Pillow directly.
2. stderr silently swallowed in _run_model_rounds
The per-round lighteval subprocess was invoked with stdout+stderr
both → DEVNULL, so any crash (like the Pillow ImportError above)
produced no visible output and the caller just saw 'No round parquet
files produced' with no clue why. Now capturing stderr, checking
returncode, and printing the last 30 lines of stderr on failure.
stdout stays quiet (lighteval's noisy progress output is not useful
for success cases).
Found while bringing charon (first ggu…
fix(probe): system-python capability check via ollama binary
Snider+1: Virgil
aeeba46
The earlier fix probed 'openai' via import at the install.sh /
lem-eval.sh level, but those scripts run in the SYSTEM python outside
the uv venv where openai isn't installed. So charon correctly saw
mlx_lm as unavailable but then also failed the gguf probe and
reported 'no target types detected'.
Switch to a presence check: ollama binary in PATH → gguf capability.
That's the right proxy anyway — we run gguf via Ollama's OpenAI
endpoint, and if ollama isn't installed we can't run anyway.
mlx probe unchanged (only meaningful on Darwin).
Co-Authored-By: Virgil <virgil@lethean.io>
Two bugs install.sh and lem-eval.sh both had:
1. Stale capability probe fallback — when mlx_lm import failed (linux),
the code fell back to {'mlx'} as the allowed type set. Charon then
tried to clone/run the mlx targets anyway, picking up lthn/lemer-mlx
into workspaces/lemer instead of the intended lthn/lemer gguf repo.
Now probes gguf independently via 'openai' import and errors out
with no fallback if neither backend is detected.
2. Runner keyed off target NAME only. With the composite (name, type,
quant) key we introduced earlier, multiple entries share 'lemer'
— the old code would race them into the same workspace dir and
eval.py would refuse to pick one (multiple matches). Python block
now emits pipe-separated 'name|type|quant|repo' tuples; run_target
takes all four and passes --type and --quant explicitly to eval.py.
install.sh pre-clone loop now:
- dedupes by repo id (multiple gguf quants share lthn/lemer — one clone)
- uses derive_repo_id() …
targets: lemer complete — all 6 quant slots verified e2e
Snider+1: Virgil
541e34f
Added gguf Q8_0 and gguf BF16 target rows. Lemer now has six fully
paired quant variants across both inference backends, each validated
end-to-end through eval.py with its own type-and-quant-scoped canon:
mlx Q4 → LetheanNetwork/lemer-mlx vs lthn/lemer-mlx
mlx 8bit → LetheanNetwork/lemer-mlx-8bit vs lthn/lemer-mlx-8bit
mlx BF16 → LetheanNetwork/lemer-mlx-bf16 vs lthn/lemer-mlx-bf16
gguf Q4_K_M → hf.co/LetheanNetwork/lemer:Q4_K_M vs hf.co/lthn/lemer:Q4_K_M
gguf Q8_0 → hf.co/LetheanNetwork/lemer:Q8_0 vs hf.co/lthn/lemer:Q8_0
gguf BF16 → hf.co/LetheanNetwork/lemer:BF16 vs hf.co/lthn/lemer:BF16
Pre-requisite: generated Q8_0 and BF16 gguf for LetheanNetwork/lemer
earlier this session via llama.cpp convert_hf_to_gguf.py + llama-quantize,
and fixed pipeline_tag on that repo (was any-to-any, HF's llama.cpp
manifest endpoint requires image-text-to-text or text-generation).
Lemer e2e done. The family rollout for lemma/lemmy/lemrd is now a
mechanical replication of t…
feat: add quant field — (name, type, quant) is the composite target key
Snider+1: Virgil
0d3a2ba
With the LEM-Eval schema settling, the next axis we need to benchmark
is quantization: does Q4 give the same LEK delta as BF16? Q8_0 vs Q4_K_M?
These are first-class variants that need their own canons so per-round
stats don't blend across precision levels.
targets.yaml now carries a 'quant' field on each row. Lemer expands to
four working entries:
lemer / mlx / Q4 → LetheanNetwork/lemer-mlx vs lthn/lemer-mlx
lemer / mlx / 8bit → LetheanNetwork/lemer-mlx-8bit vs lthn/lemer-mlx-8bit
lemer / mlx / BF16 → LetheanNetwork/lemer-mlx-bf16 vs lthn/lemer-mlx-bf16
lemer / gguf / Q4_K_M → hf.co/LetheanNetwork/lemer:Q4_K_M vs lthn/lemer
Q8_0 / BF16 gguf entries pending LetheanNetwork/lemer having the matching
base gguf quants uploaded (llama-quantize + HfApi follow-up).
eval.py changes:
resolve_target()
takes quant_filter; (name, type, quant) is now the unique key.
Multiple matches → error asks for --type / --quant.
--quant CLI flag
optional. Auto-…
targets: uppercase gguf tags (Q4_K_M)
Snider+1: Virgil
2751c6b
HF's Ollama matcher is case-insensitive so lowercase worked, but the
canonical llama.cpp convention is uppercase (Q4_K_M, Q8_0, BF16).
Aligning on the convention everywhere for consistency.
Co-Authored-By: Virgil <virgil@lethean.io>
targets: swap mlx base from mlx-community to LetheanNetwork/lemer-mlx
Snider+1: Virgil
13a0c89
Removes the mlx-community dependency — we now host our own mlx quants
under LetheanNetwork/lemer-mlx (4bit, converted from
LetheanNetwork/lemer's bf16 safetensors via mlx_lm.convert). This is
the unmodified Google Gemma 4 E2B-IT weights, just hosted in our
namespace so benchmark targets don't rely on an external mirror.
Smoke-tested: paired mlx run through eval.py with the new base loads
cleanly and writes mmlu_pro.mlx.parquet. The base got a single-sample
stochastic win on the Po-210 trick question (gold I, 5.40 MeV) where
mlx-community's version had been consistently missing — too small to
attribute to our quant being better, but worth noting and watching
in 8-PAC canon as it grows.
Co-Authored-By: Virgil <virgil@lethean.io>
fix: capability probe promotes both backends independently
Snider+1: Virgil
b5a2983
detect_default_types() previously fell back to {mlx} when mlx_lm
wasn't importable, which would cause charon (Linux, no mlx) to try
mlx targets and fail. Now each backend is probed independently:
mlx = mlx_lm importable + Darwin
gguf = openai importable
Studio (mac) sees {mlx, gguf} since openai is always in the PEP 723
closure. Charon (Linux) sees {gguf} since mlx_lm import raises. Empty
detection triggers an explicit error in main() asking the caller to
set LEM_TYPES, instead of silently routing to an empty target list.
Co-Authored-By: Virgil <virgil@lethean.io>
Three intertwined changes:
1. gguf_wrapper.py
New lighteval custom-model backend that routes inference through an
Ollama (or any OpenAI-compatible) endpoint hosting GGUF models.
Same sampling policy as mlx_lm_wrapper (Google-calibrated Gemma 4:
temp=1.0 top_p=0.95 top_k=64, think=true in extra_body). Endpoint
configurable via LEM_OLLAMA_URL (default http://localhost:11434/v1).
Tokenizer not available through OpenAI API; max_length generous so
lighteval length accounting doesn't trip. loglikelihood* raise
NotImplementedError — use generative metrics only.
2. eval.py: composite (name, type) target key
Same target name can now appear multiple times in targets.yaml with
different types (e.g. 'lemer' runs as mlx on Apple Silicon AND as
gguf via Ollama). resolve_target() takes a type_filter and errors
cleanly when multiple entries match and no --type disambiguates.
main() passes the capability-detected types so --target lemer just
works on each wor…
refactor: partition by type (mlx|gguf), drop owner hostname field
Snider+1: Virgil
86b06f4
Routing by 'owner: <hostname>' coupled the fleet to specific machine
names and broke whenever a machine was renamed or replaced. Routing by
'type: <backend>' instead describes the actual constraint: what
inference path the target needs. Workers detect their own capabilities
at runtime (import mlx_lm + platform check → mlx; explicit opt-in for
gguf until that wrapper lands) or take an explicit LEM_TYPES env
override. Partition falls out of what the hardware can do.
Changes:
targets.yaml
lemer, lemma type: mlx (Apple Silicon workers)
lemmy, lemrd type: gguf (GGUF workers — via Ollama endpoint on charon)
eval.py
- SUPPORTED_TYPES = {'mlx', 'gguf'}
- detect_default_types() probes mlx_lm import + Darwin platform
- --type flag overrides capability detection
- LEM_TYPES env var takes precedence over both
- --my-targets filters by allowed_types (was: by hostname owner)
- gguf targets fail fast with explicit TODO: wrapper not yet implemented
lem-…
Dataset-as-github repo for the LEM-Eval benchmark pipeline. Workers
clone this, run ./install.sh to bootstrap (clones lem-benchmarks and
each owned target model repo locally), then cron runs lem-eval.sh once
every 30 min to advance per-target canons.
Components:
- eval.py
Target-driven runner (PEP 723 self-contained). Takes --target NAME,
looks up (base, this) from targets.yaml, runs lighteval's paired
A/B, appends rows to up to two canonical destinations:
1. <model-repo>/.eval_results/<task>.parquet (primary)
2. <lem-benchmarks>/results/<target>/<task>.parquet (aggregated)
Uses LetheanNetwork/lighteval@dev for benchmark stability (MMLU-Pro
template fix + --samples-start offset).
- mlx_lm_wrapper.py
Lighteval custom model backend for Apple Silicon. Google-calibrated
sampling, chat template with enable_thinking=True (load-bearing for
LEK'd models).
- targets.yaml
Declarative fleet spec. Four Lemma family members with owner fields
…