<< All versions
Skill v1.0.0
currentAutomated scan100/100wenmin-wu/ds-skills/answer-accumulation-filter
──Details
PublishedOctober 20, 2026 at 03:12 AM
Content Hashsha256:13b00dedda249be6...
Git SHA
──Files
Files (1 file, 2.4 KB)
SKILL.md2.4 KBactive
SKILL.md · 61 lines · 2.4 KB
version: "1.0.0" name: llm-answer-accumulation-filter description: Parse sequential yes/no answers to build inclusion/exclusion sets, then apply compound boolean filters to narrow a candidate list
Answer Accumulation Filter
Overview
In multi-turn question-answering games, each yes/no answer constrains the solution space. Maintain parallel inclusion and exclusion sets for each attribute dimension (category, region, letter). After each answer, update the appropriate set, then apply all filters as a compound boolean mask on the candidate dataframe. This turns sequential dialogue into progressively tighter database queries.
Quick Start
python
import pandas as pdclass AnswerAccumulator:def __init__(self, candidates_df):self.candidates = candidates_dfself.include = {} # attr -> set of included valuesself.exclude = {} # attr -> set of excluded valuesdef update(self, attr, value, answer_is_yes):if answer_is_yes:self.include.setdefault(attr, set()).add(value)else:self.exclude.setdefault(attr, set()).add(value)def filter(self):mask = pd.Series(True, index=self.candidates.index)for attr, vals in self.include.items():mask &= self.candidates[attr].isin(vals)for attr, vals in self.exclude.items():mask &= ~self.candidates[attr].isin(vals)return self.candidates[mask]acc = AnswerAccumulator(keywords_df)acc.update('category', 'place', answer_is_yes=True)acc.update('continent', 'Europe', answer_is_yes=False)remaining = acc.filter() # all places not in Europe
Workflow
- Initialize with full candidate dataframe and empty include/exclude dicts
- After each yes/no answer, call
update(attribute, value, is_yes) - Call
filter()to get remaining candidates matching all constraints - Use
len(remaining)to decide whether to ask more questions or guess
Key Decisions
- Attribute dimensions: category, region, first_letter are typical; add more for richer datasets
- Include vs exclude: "yes" → include (whitelist), "no" → exclude (blacklist)
- Multiple includes: if multiple values included for same attribute, use OR (any match)
- Empty sets: no constraint on that dimension — don't filter
References
- [Starter Code for Llama 8B LLM - [LB 0.750+]](https://www.kaggle.com/code/cdeotte/starter-code-for-llama-8b-llm-lb-0-750)