floop: anonymize named entities before INIT (his design) #16

Merged
onibot merged 1 commits from feature/init-anonymization into main 2026-10-22 16:48:48 +02:00
Owner

His design: the model was using its own knowledge of the people in the question to decide decomposition (his qwen collapsed Pedro Sanchez to ONE subquestion). INIT now sees the question's SHAPE, not identity.

  • EntityMaskSignature (typed NER): entities as list[NamedEntity] (verbatim name + kind)
  • apply_mask/restore_mask: deterministic (LLMs propose, code applies) — longest names first, one placeholder per surface text, typed prefixes, restore longest-first
  • init_decompose: mask → INIT → restore in each subquestion; no entities found OR mask death → passthrough, never a dead run
  • MASK stage in the prompt log

Verified: tests/anonymize.py 4/4; suite 15/15. Live E2E (glm-5.3-flash): MASK found exactly 'Pedro Sanchez' (reasoning explicitly excluded 'President' as a role); INIT saw 'Who was the President before PERSON_1?' and split into FOUR subquestions — the shape split he wanted, plus a 'who is PERSON_1' question; run answers Rajoy correctly.

Open (his question): the model now asks WHO the placeholder is (one extra call). Options: (a) keep, (b) desc note, (c) masked question + original as context. Not decided.

His design: the model was using its own knowledge of the people in the question to decide decomposition (his qwen collapsed Pedro Sanchez to ONE subquestion). INIT now sees the question's SHAPE, not identity. - **EntityMaskSignature** (typed NER): entities as list[NamedEntity] (verbatim name + kind) - **apply_mask/restore_mask**: deterministic (LLMs propose, code applies) — longest names first, one placeholder per surface text, typed prefixes, restore longest-first - **init_decompose**: mask → INIT → restore in each subquestion; no entities found OR mask death → passthrough, never a dead run - **MASK stage** in the prompt log **Verified:** tests/anonymize.py 4/4; suite 15/15. Live E2E (glm-5.3-flash): MASK found exactly 'Pedro Sanchez' (reasoning explicitly excluded 'President' as a role); INIT saw 'Who was the President before PERSON_1?' and split into FOUR subquestions — the shape split he wanted, plus a 'who is PERSON_1' question; run answers Rajoy correctly. **Open (his question):** the model now asks WHO the placeholder is (one extra call). Options: (a) keep, (b) desc note, (c) masked question + original as context. Not decided.
onibot added 1 commit 2026-10-22 16:48:47 +02:00
The model was using its own knowledge of the people in the question
to decide decomposition (his qwen collapsed Pedro Sanchez to ONE
subquestion: 'the question is nearly atomic because I know who he
is'). Structural fix: INIT sees the question's SHAPE, not identity.

- EntityMaskSignature (typed NER proposal): entities as list[NamedEntity]
  (name verbatim + kind) — the typed-output law, no string parsing
- apply_mask/restore_mask: DETERMINISTIC code (LLMs propose, code
  applies): longest names first, one placeholder per surface text,
  typed prefixes PERSON_1/ORGANIZATION_1/..., restore longest-first
  (PERSON_10 never eaten by PERSON_1)
- init_decompose: mask -> INIT -> restore in each returned subquestion;
  MASK finding no entities OR dying (AdapterParseError) -> passthrough,
  never a dead run
- MASK stage in the prompt log (prompts/01-MASK.txt)

VERIFIED: tests/anonymize.py 4/4 (deterministic apply/restore, E2E
mask+restore, no-entity passthrough, mask-death passthrough); suite
15/15. Live E2E (glm-5.3-flash): MASK found exactly Pedro Sanchez
(reasoning explicitly excluded 'President' as a role, not entity);
INIT saw 'Who was the President before PERSON_1?' and returned FOUR
subquestions (identity, office, term start, predecessor) — the shape
split he wanted, plus a 'who is PERSON_1' question; run answers Rajoy
correctly (E1-E4).

OPEN (his question pending): the model now asks WHO the placeholder
is, spending one call per run. Options: (a) keep, (b) desc note that
placeholders are known entities, (c) give INIT the masked question PLUS
the original as context. Not decided — he answers when back.
onibot merged commit 56e3b22bbf into main 2026-10-22 16:48:48 +02:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: onibot/floop#16