Skip to main content

Speaker stance classifier

Issue: #1391. Decided 2026-11-27. Builds on Mixed comments: speakers, stance shapes, attribution and heat (#1386), which left most public speakers unclear (40,961 of 76,592) or concerns_only (22,332) because captions rarely say "I support" or "I oppose".

What runs​

python -m llm.typesafe.speaker_stance asks TypeSafe Jev, once per (public speaker, topic), two things about the passages of that speaker's own turn text that name the topic (build_state: 700 characters each side of every keyword hit, merged, at most 2,800 characters, speaker_state/1):

  • side (Choice): for / against the topic's concrete local action, concerns_only, no_position, off_topic;
  • heat: four yes/no thresholds (heat_2 .. heat_5); heat is 1 plus the consecutive thresholds judged true.

A speaker is read only for the topics their own words match: the curated topic's seed keywords (the phrases behind meeting_comment.topic_ids), or the reframed topic's own whole-word phrases. Possible minors and every speaker at a school-board meeting are never sent. Jev returns probabilities, never text, and rows are keyed by meeting_speaker_id (a hash; never linked across meetings), so nothing here names anyone.

Readings land in bronze.bronze_speaker_topic_stance_jev (PK speaker, topic, question_version) as each answer arrives. A rerun skips everything already read at the topic's current question version and pays nothing twice; a 401, 402 or 403 stops the run at once with a progress summary (--summary-json), so a top-up resumes with the same command.

Topics​

The candidates were the original curated stories (100001-100020) and the most-discussed or fastest-rising CivicSearch topics on the year-over-year list (/api/topics/yoy, 2025 against Jan-Nov 2026). A topic was kept only where a resident can be for or against a concrete local decision.

Chosen (19 defined)​

topicid"for" meanssource
data-centers100001approving / building a data centercurated
water-fluoridation100002keeping or adding fluoridecurated
short-term-rentals100003allowing short-term rentalscurated (meeting-level TopicDef)
license-plate-readers100004buying, keeping or expanding the camerascurated (meeting-level TopicDef)
guns100005a local gun limit (against = gun rights)curated (meeting-level TopicDef)
pickleball100006building or keeping courts / playcurated (meeting-level TopicDef)
traffic-safety100010speed humps, lower limits, cameras, crosswalkscurated
police-staffing100011more police funding, officers or paycurated; absorbs "Police matters" (66)
parks-funding100016spending on parks and recreationcurated; absorbs "Parks and Recreation" (30)
homelessness-and-shelters100018shelters, services or housing for homeless peoplecurated; absorbs "Homelessness issues" (27)
immigration-and-sanctuary100019limiting local help to ICE (sanctuary); against = working with ICEcurated
bike-lanes100020building or keeping bike lanes / pathscurated; absorbs "Bicycle transportation" (57)
local-taxation74raising local taxes or feesreframed from "Local taxation"
affordable-housing83approving or funding affordable housingreframed
zoning-regulations77rezoning to allow denser housingreframed from "Zoning regulations"; absorbs "Land use" (78)
renewable-energy90approving local solar / wind / battery projectsreframed from "Renewable energy"
surveillance-cameras28expanding city surveillance camerasreframed (rising 2.66x)
public-transit55expanding or funding transitreframed
alcohol-licensing14approving a liquor license or alcohol salesreframed

Data centers keeps its own definition (the meeting screen's question lives in screen_transcripts). Water fluoridation's speaker question asks plain keep / end, not the meeting screen's five positions. The meeting-level TopicDefs and their pinned hashes are untouched (test_meeting_topic_hashes_unchanged).

Dropped, with reasons​

  • No local position (generic buckets): Property ownership (82), Education, schools, students (51), Budget discussions (121), Planning process (70), Debt management (96), Insurance discussions (21), Permit processes (68), Financial audit (79), Bidding process (49), Water management (110), Stormwater (109), Sewer infrastructure (97), Building setbacks (105), Fire department (22), Emergency Medical Services (23), Street lighting (47), Swimming pools (15), Signage regulations (54), Parking issues (29), Downtown development (56). Residents talk about these, but there is no single for/against decision their comments map to.
  • Merged into a curated topic: Police matters, Parks and Recreation, Homelessness issues, Bicycle transportation, Gun violence (65, into guns), Drugs (18), Land use.
  • Curated, no position: Violent crime (100007), Theft and break-ins (100008), Domestic violence (100013), Fire and EMS (100015), Animal shelters (100017): reports and concern, not a contested measure.
  • Curated, dropped for safety: Drugs and overdoses (100009) mixes harm-reduction sites with health conditions (AGENTS.md, sensitive data); Youth crime (100012) and School safety (100014) are about minors and school boards.

Question coverage (#1436)​

Issue: #1436. The owner asked that the local questions residents most often argue about in town meetings are all asked. A company with a similar public page is listed in the citations as reference-only. Its list was used only to check coverage: none of its data, numbers, wording or layout is used, and every definition below is ours.

questionour topicstatus
data centersdata-centers (100001)covered
plate-reader cameraslicense-plate-readers (100004)covered
surveillance camerassurveillance-cameras (28)covered
short-term rentalsshort-term-rentals (100003)covered
pickleball courtspickleball (100006)covered
bike lanesbike-lanes (100020)covered, held (#1402)
upzoning for more homeszoning-regulations (77)covered, held (#1402)
duplexes / missing middlemissing-middle-housing (100101)new; zoning-regulations covers it only in part
road dietsroad-diets (100102)new
backyard chickensbackyard-chickens (100103)new
speed camerasspeed-cameras (100104)new; traffic-safety (held) bundles it with humps and crosswalks
speed bumpsspeed-bumps (100105)new; same bundling
roundaboutsroundabouts (100106)new
gas stations / travel centersgas-stations (100107)new
artificial turf fieldsartificial-turf (100108)new
clearing homeless encampmentshomeless-encampments (100109)new; homelessness-and-shelters asks about shelters, not clearing camps
solar farmssolar-farms (100110)new; renewable-energy bundles solar, wind and battery
battery storage facilitiesbattery-storage (100111)new; same bundling

The eleven new topics are NEW_TOPICS in llm.typesafe.speaker_stance. Each has a plain "for" (the action moving forward: allowing duplexes, narrowing the road, clearing the camp, approving the station) and its own whole-word phrases, which decide which speakers are asked (strict_pattern: "rotary" never matches roundabouts, "a bump in the road" never matches speed bumps). Renewable energy, traffic safety and homelessness-and-shelters keep their wording and pinned hashes. The new topics sit beside them, so a speaker on a solar farm can be read on both renewable energy and solar farms. Each is listed as its own question and never summed with the bundled topic.

All eleven start held, and run only once a gold set passes the same gate as above. Their ids (100101-100111) are appended to the curated_topics seed, so readings can join civicsearch_topic. Seed after #1401 reconciles the warehouse's 100007-100020.

Gold set, round 2 (AI-helper labels)​

gold/speaker_stance_gold_round2.json holds 538 items: about 30 random and up to 20 stance-cue passages per new topic (fewer where the topic is rare), plus 40 more cue passages each for held bike lanes and zoning. Its labels were made by an AI helper (Claude) from the exact passage, blind to any Jev output. No person has reviewed them yet, and the file says so in labelled_by. Like round 1, it carries no speech: keys, labels, passage hashes and a short note with no names.

topicitemsclearforagainstconcerns onlyno sideoff topic
missing-middle-housing509873626
homeless-encampments50810119416
speed-bumps43101423159
battery-storage35133104414
solar-farms457674424
speed-cameras317820318
artificial-turf335704616
gas-stations505571136
road-diets384602822
roundabouts414623327
backyard-chickens423511134
bike-lanes (held; + round 1)40 (+50)11 (+6)1633414
zoning-regulations (held; + round 1)40 (+50)7 (+5)291127

The gate needs at least 8 clear items, so only six topics can pass on this set: missing-middle housing, homeless encampments, speed bumps, battery storage, and bike lanes and zoning (round 1 + 2 together, report --all-rounds). The other seven need more labels before any score could pass them. Their passages are mostly off topic: "turf" as territory, chicken dinners, gas prices, "a roundabout way", and the public-comment flag letting staff through. Scoring them anyway costs under a cent and shows whether Jev drops those off-topic passages.

Cost estimate and run plan (paid; waits for the owner's yes in the session that runs it)​

Rate: $0.042 per 1M Jev input tokens (llm/usage/prices.yaml). The free dry run (2026-11-28) counts the speakers whose own words match each topic's phrases:

stepcallsestimate
score round-2 gold (538 items; about 1,090 tokens each, as in round 1)538~$0.025
full run, all 13 new and held topics9,518~$0.44
of which: zoning-regulations 5,098, missing-middle 1,075, bike-lanes 807, gas-stations 601, roundabouts 373, homeless-encampments 367, backyard-chickens 267, solar-farms 237, speed-bumps 229, road-diets 151, battery-storage 146, artificial-turf 113, speed-cameras 54

Only topics that pass go to the full run. The likely ceiling is the six gate-eligible topics, about 7,722 calls and about $0.36. The whole task stays under $0.50, against the previous 13-topic run's $0.94. Commands, in order:

python -m llm.usage.report --since 2026-11-28 # usage before
python -m llm.typesafe.speaker_stance_gold score \
--gold packages/llm/src/llm/typesafe/gold/speaker_stance_gold_round2.json \
--results packages/llm/src/llm/typesafe/gold/speaker_stance_gold_round2_results.json --max-usd 0.10
python -m llm.typesafe.speaker_stance_gold report \
--gold packages/llm/src/llm/typesafe/gold/speaker_stance_gold_round2.json \
--results packages/llm/src/llm/typesafe/gold/speaker_stance_gold_round2_results.json
python -m llm.typesafe.speaker_stance_gold report --all-rounds # bike lanes and zoning across both rounds
# then name only the topics whose "passes" is true (held topics run when named):
python -m llm.typesafe.speaker_stance --topic <passing,slugs> --max-usd 1.0 --summary-json <scratch>/run.json
python -m llm.usage.report --since 2026-11-28 # usage after

Both commands write as each answer arrives, skip what is already read at the topic's question version, and stop cleanly on 401, 402 or 403. Within a topic, the hottest and most contested meetings go first, with 2026 breaking ties. Then rebuild meeting_speaker_topic_side and topic_place_ranking, and release the passing topics from HELD in a follow-up PR with their gold numbers.

Positions in plain words​

web_app/src/utils/topicPositions.ts has an entry per topic in everyday words ("Want more homes allowed" / "Against denser zoning"; immigration names both sides: "Favor sanctuary limits" / "Favor working with ICE"), and speakerSideLabel() says "Concerns only", "No side taken" or "Not sure" for the rest. A position says what was said; it never infers a trait.

Validation: hand labels, not another model's opinion​

950 real public speakers, 50 per topic (30 random, then 20 whose passage holds a first-person stance cue, CUE_RE), were labelled by hand from the exact passage Jev is sent, blind to any model output: one of the five sides, plus clear when a for/against side is plain from the passage alone. The committed file (packages/llm/src/llm/typesafe/gold/speaker_stance_gold.json) carries no speech: speaker hash, topic, label, the passage's SHA-256 and a short reason with no name. python -m llm.typesafe.speaker_stance_gold score rebuilds each passage, checks its hash and asks Jev; Jev's answers are committed beside it and tests/test_speaker_stance.py recomputes every number below.

A topic proceeds only with at least 8 clear items, clear accuracy >= 85%, no for/against swap, and >= 80% of the sides it would serve (at the 0.8 floor) matching the hand label.

topicitemsclearclear accswapsserved-side precision @0.8run
affordable-housing5091.000.842yes
alcohol-licensing50111.001.0yes
bike-lanes5061.000.571held
data-centers50321.000.97yes
guns5081.000.9yes
homelessness-and-shelters5091.000.846yes
immigration-and-sanctuary50211.000.808yes
license-plate-readers50271.001.0yes
local-taxation4971.000.7held
parks-funding5071.000.733held
pickleball50120.91700.938yes
police-staffing50231.000.933yes
public-transit3631.000.6held
renewable-energy50101.000.909yes
short-term-rentals50181.000.905yes
surveillance-cameras50120.91701.0yes
traffic-safety5061.000.9held
water-fluoridation50201.000.909yes
zoning-regulations5051.000.857held

Jev never swapped for and against on a clear case. The errors are the other way: on passages the labellers called off_topic or no_position (often staff presenting, or a passing mention), Jev sometimes picks a side. The floor answers that: across all topics, sides served at P >= 0.6 matched 79% of the time, at 0.7 84%, at 0.8 88% (keeping 93% of the clear cases), at 0.9 92% (keeping 83%). The floor is 0.8 (MIN_SIDE_CONFIDENCE, dbt var speaker_side_min_confidence); below it the mart says not_sure, which is never counted. concerns_only is weaker (67% at 0.8 on 9 items) and is shown as its own label, never as a side.

Six topics are held (HELD; --topic all skips them, naming one still runs it): too few clear items to show 85%, or too many wrong sides served. More hand labels for them is follow-up work, not a re-run of anything paid.

The gold run cost 935 calls, 1,018,620 input tokens, $0.0428; about 1,090 input tokens per speaker-topic.

Run order​

Owner: "sort by the most trending topics with heat or different opinions". python -m llm.typesafe.speaker_stance_priority (free) scores each topic as normalized rise + normalized contention + normalized heat, equal weights, each min-max scaled 0-1 across the 19 topics:

  • rise: 2026 share of recorded meetings over 2025 share (topic_meeting_year, the numbers behind /api/topics/yoy);
  • contention: of the meetings where a public speaker named the topic, the share with one 'for' cue shape and another 'against' one; averaged with the Jev per-meeting share where the public was split or officials sided against it, where topic_meeting_lean exists;
  • heat: mean AI meeting-analysis heat (gold.public_comment) in those meetings; under 5 rated comments, the median.

Data centers goes first regardless. Within a topic the hottest meetings go first (owner: "We should prioritize meetings with a lot of heat"), so if credits run out the most heated, contested meetings are already read. A free pre-run estimate per meeting (meeting_heat_scores), four parts each scaled 0-1 and summed with equal weights:

  • ai_heat: the AI meeting analysis's highest comment heat in the meeting (gold.public_comment, 1-5 to 0-1; 0 when none);
  • speakers: public speakers at the meeting, ln(1 + n) / ln(1 + the largest meeting's n);
  • contested: for that topic, topic_meeting_lean says both sides spoke (mixed) or officials sided against the public;
  • chair_cues: the chair keeping order in the transcript (point of order, out of order, your time is up, please address the board, recess), ln(1 + n) / ln(1 + the 99th percentile), capped at 1.

2026 meetings break ties, then newest first.

#topicmeetingsrisecontentionrated commentsheatscore
1data-centers6705.560.07282.542.095
2license-plate-readers3293.370.10612.411.748
3short-term-rentals1,3091.550.15922.081.513
4immigration-and-sanctuary1631.850.02303.071.297
5police-staffing2811.530.03133.001.257
6guns1,9591.360.11592.201.251
7surveillance-cameras1,3222.660.02972.411.074
8zoning-regulations3,1281.930.041462.351.017
9homelessness-and-shelters1,7011.290.041012.550.994
10affordable-housing1,6661.400.04472.360.878
11pickleball9621.160.0692.220.857
12water-fluoridation1680.800.050(median)0.798
13alcohol-licensing6801.290.034(median)0.760
14bike-lanes6761.590.01122.330.742
15traffic-safety1,0081.450.01462.350.704
16local-taxation2,4901.150.02792.140.583
17renewable-energy3631.700.02102.000.580
18public-transit1,4020.870.02431.770.245
19parks-funding7321.320.01191.530.109

What is served​

  • gold.meeting_speaker_topic_side: one row per meeting x public speaker x topic; side (not_sure under the floor, off_topic dropped), side_confidence, side_method = 'classifier', side_version = jev:<question_version>, heat (served at heat_confidence >= 0.65), PK (speaker, topic), FKs to meeting_speaker_position, civicsearch_topic and jurisdictions. Public serves a slim projection without the not_sure rows.
  • meeting_speaker_position.heat: the AI meeting analysis's rating is kept where it exists; otherwise the classifier's heat (mean over the speaker's topics), heat_method = 'classifier', its mean margin as confidence, version jev:<question_version>.
  • /api/topics/yoy returns heat_rated / heat_mean per topic in scope (mean only with >= 20 rated speakers), behind the Most heated sort on Browse all topics (#1407). Only served (confident-side) rows count.
  • /api/topics/{topic}/caption-facts returns classifier_speakers (for, against, concerns only, no position, meetings), a separate source labelled "speakers' own words, classifier", never added to the hand-counted speakers. The data-center Positions summary shows it as its own line.

Budget​

The owner authorised up to $40, then capped it at the prepaid balance: $25 funded on 2026-11-26, less $5.9485 of Jev spend since (python -m llm.usage.report --since 2026-11-26), minus a $1 margin. The run's own --max-usd stops it at the cap. Results and exact cost are in the issue and PR.

Results of the 2026-11-27 run​

All 13 validated topics were read: 18,878 speaker-topics (plus 6 from the skip-logic check), 21,291,040 input tokens, $0.8942; with the gold run ($0.0428) the task spent $0.9370 of the $18.0 cap. Container restarts stopped the run twice; each restart's job build counted the rows already read as done, so nothing was paid for twice.

topicreadon topicfor @0.8against @0.8concerns onlyno sidenot sure
homelessness-and-shelters2,9741,62466749752849
affordable-housing2,6852,1529907418561,014
guns2,44064915311744371
data-centers2,4302,2141521,11917958706
short-term-rentals2,0951,8794853323677949
surveillance-cameras2,0541,1091514631312470
pickleball1,269876256612062477
alcohol-licensing903700135642542434
license-plate-readers59057782250814223
renewable-energy48728549561814148
police-staffing4093313317776108
immigration-and-sanctuary29519995320072
water-fluoridation25319450715365

Among on-topic speakers read, the share the free cue rules left unclear or concerns_only and the classifier did not give a confident side fell from 74.5% to 36.1% for data centers (2,214 speakers) and 62.6% to 34.7% for guns (649). Guns has the most off-topic hits (1,791 of 2,440: caption errors such as "fire arm", gun-violence talk with no limit at issue), which the classifier drops.

Heat: 6,499 public speakers now carry a classifier heat (heat_confidence >= 0.65), beside the 138 with the AI meeting analysis's rating, which is kept. On the 22 speakers that have both, the classifier's heat matches exactly 22.7% and within 1 point 90.9% (Pearson 0.65), against 13.6% / 77.3% for a constant guess of 2; the overlap is small, so heat is shown with its method and confidence and is not used to rank anything without a minimum count.

gold.meeting_speaker_topic_side holds 12,789 rows (3.5 MB); the public projection drops the 5,886 not_sure rows (6,903 rows). Publish with --only meeting_speaker_topic_side meeting_speaker_position (the second for the classifier heat); no other serving table changes.

Known limits​

  • The current question version per topic is the one read most recently, so a reworded topic that is only part-way re-read hides its older readings until the re-read finishes; finish a re-read before rebuilding the mart.
  • The curated ids 100010-100020 come from the warehouse's seed (the crime / parks / bike-lanes topic branches); main's seed file does not have them yet (#1401).
  • Six topics are held (#1402). Usage rows lost at container restarts: #1403.