Skip to content

fix(volumes): estimate prompt volume from the median of its keywords at a 45% AI adoption rate - #1103

Merged
gkhngyk merged 2 commits into
ansvisor:mainfrom
cihan-gyk:fix/prompt-volume-median
Oct 17, 2026
Merged

gkhngyk merged 2 commits into
ansvisor:mainfrom
cihan-gyk:fix/prompt-volume-median

Conversation

@cihan-gyk

@cihan-gyk cihan-gyk commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Two fixes to prompt volumes.

  1. A prompt's Google volume was the sum of its five keywords' monthly searches, which made volumes far too large. It is now their median.
  2. The default AI adoption rate goes from 15% to 45%. AI Overviews now appear on roughly 43–48% of Google searches.

The live Insights tab for a 709-prompt brand read:

  • Total Est. AI Volume ~11.7M, from 78M Google searches;
  • Avg. AI Volume ~16.5k per prompt;
  • "How to increase citations in Gemini?" alone ~755k a month.

Why the sum inflates. Volume analysis gives each prompt five head terms for its category (intent-extraction.js, #11), which is the right call: long-tail terms come back as 0. But the five overlap, so adding them up counts the same searchers several times. One broad term can also set the whole figure: the Gemini prompt's keywords included "google gemini" (5M a month).

Why 45%. The AI adoption rate (AI_VOLUME_MULTIPLIER) is the share of a prompt's Google volume estimated to get an AI answer. Its 15% default matched the share of Google searches that showed an AI Overview a year ago. They now appear on roughly 43–48% (1, 2).

On that brand (computed from the live per-keyword volumes; monthly figures):

Total Est. AI Avg Median p90 Gemini prompt
Sum × 15% (before) 11.7M 16.5k 4.7k 41k 755k
Median × 15% 770k 1.1k 540 2.2k 1.2k
Median × 45% (now) 2.3M 3.3k 1.6k 6.7k 3.6k

No prompt drops to 0: keywords Google can't measure are left out of the median, as they added nothing to the sum.

What changes

  • server/src/lib/volume-analysis.js
    • medianVolume (exported): the median of the volumes above 0, rounded.
    • summarizeVolumes uses it for totalGoogleVolume, and estAiVolume is that × AI_VOLUME_MULTIPLIER.
    • A keyword that resolves to the same returned one (e.g. "CRM" and "crm") counts once, in the median and in the competition average.
    • The keyword extraction is unchanged.
  • Migration 00154_prompt_volume_median.sql recomputes stored rows the same way from their google_volumes. Nothing is looked up again: no DataForSEO or LLM cost.
    • It uses percentile_cont(0.5), with only numeric values cast.
    • A row with no measured keyword stays at 0.
    • It touches only rows whose values change.
    • total_google_volume keeps its name and now holds the median; a column comment says so.
  • server/src/lib/intent-extraction.js: AI_VOLUME_MULTIPLIER defaults to 0.45 when the env doesn't set it. server/.env.example now sets 0.45.
  • Migration 00155_ai_volume_multiplier_45.sql moves rows stored at the old default (0.150) to 0.450 and recomputes their est_ai_volume. Rows saved under any other rate were set on purpose by the install, and are left alone.
  • supabase/seed.sql: the demo volumes follow both rules.
  • supabase/schema.sql: regenerated.
  • Docs: docs/guides/prompts.mdx and docs/self-host/env-variables.mdx describe the median and the 45% default.

Goes with #1104

#1104 (web) counts each keyword once in Similar Topics and moves the High Opportunity thresholds (5k / 10k) to the new scale (1,500 / 3,000). Please merge the two together. On its own, this one leaves Similar Topics' header smaller than its rows and the High Opportunity card nearly empty.

Deploy and follow-ups

  • AI_VOLUME_MULTIPLIER on the live server. If the env sets it to 0.15, as .env.example did, change it to 0.45 or remove it when deploying. Otherwise new analyses keep writing 15% next to rows that 00155 moved to 45%. Self-hosted installs that copied the example are in the same position.
  • Deploy the server with or before 00154 and 00155. An analysis run by the old server after the migrations would write a sum at 15% again, for those prompts only, until they're refreshed.
  • Stored suggestions (est_volume, an LLM guess calibrated on the tracked prompts' volumes) shrink as they refresh (48h). Content and Action Center opportunities already created keep their saved demand.
  • Server thresholds:
    • highDemandVolume (100) and Improve's volume tiers (100 / 1,000) keep their values. With the sum almost every prompt cleared them; at the new scale (median prompt ~1.6k) they still separate the smallest prompts.
    • topicOpportunityImpact (50k / 10k over summed suggestion volumes) was tuned on the old scale. Once suggestions refresh it will rate most topics low. fix(action-center): lower topic opportunity impact to the new volume scale #1105 retunes it to 10k / 2k, to merge with or after this one.

Related issue

None. Product feedback on the Prompts → Insights volumes.

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

  1. Apply 00154 and 00155.
  2. Open Prompts → Insights.
    • The AI Adoption Rate reads 45%.
    • Each prompt's Google Vol. is the median of its keywords' volumes, and Est. AI Vol. is that × 45%. In the demo seed, "Best espresso machines under $500?" has 18,100 / 9,900 / 6,600 / 4,400, so it shows 8,250 and ~3.7k.
  3. Run Refresh Volumes or Re-analyze Keywords: new rows follow the same rule.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/): this PR doesn't touch web/
  • yarn typecheck passes (run from web/): this PR doesn't touch web/
  • yarn format:check passes (run from web/): this PR doesn't touch web/
  • Changes are focused — one concern per PR

Also run:

  • server: npm run format, npm run lint and npm test (1,293) pass. bash supabase/build-schema.sh regenerated schema.sql. npm run version:check fails as it does on main (compose images 0.2.0 vs 0.3.0); this PR doesn't touch versions.

  • New tests (volume-analysis.test.js), which fail on the sum:

    • the median, not the sum, with a 5M outlier;
    • unmeasured keywords left out;
    • 0 when none is measured;
    • a keyword listed twice in different case counted once, in the competition average too;
    • medianVolume itself.

    volumes-pipeline.test.js now calls medianVolume instead of re-deriving the formula in the test. intent-extraction.test.js (new) pins the 45% default and the env override; it fails on 15%.

  • Dev database:

    • Dry runs (rolled back):
      • 00154: the six demo rows and edge cases (empty map, all zeros, null and non-numeric values, even counts) match medianVolume exactly, half-way roundings included.
      • 00155: the demo rows match the seed's 45% values.
    • Applied both after that.
  • Review: a code review raised:

    The Insights platform chart's split (AI_PLATFORM_SHARES, derived with AI Overviews at ~35% of Google searches) is its own model and is unchanged. Re-deriving it at ~45% is a possible follow-up.

Commits: the median (f011fc4), then the 45% rate (bac59ed).

🤖 Generated with Claude Code

A prompt's Google volume was the sum of its five keywords' monthly
searches. The keywords are overlapping head terms for the prompt's
category, so the sum counted the same searchers several times, and one
broad term could set the whole figure: "google gemini" (5M a month) put
one prompt at ~755k estimated AI searches, and a 709-prompt brand's
Insights total read 11.7M.

summarizeVolumes now takes the median of the keywords that have a volume
(medianVolume), and a keyword that resolves to the same returned one
counts once. Migration 00154 applies the same rule to stored rows from
their per-keyword volumes, so nothing is looked up again;
total_google_volume keeps its name and holds the median. The keyword
extraction is unchanged. The seed's demo volumes and the docs follow.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the needs-migration Adds or edits a migration — apply it to the hosted database label Oct 16, 2026
@cihan-gyk

Copy link
Copy Markdown
Collaborator Author

@gkhngyk ready for review: prompt volumes now use the median of each prompt's five keywords instead of their sum (live: Total Est. AI Volume 11.7M → ~770k, avg 16.5k → ~1.1k). Migration 00154 recomputes stored rows from their saved keyword volumes, no DataForSEO/LLM calls. Please merge together with #1104 and deploy the server with or before 00154.

est_ai_volume is a prompt's Google volume times the AI adoption rate
(AI_VOLUME_MULTIPLIER). Its 15% default matched the share of Google
searches showing an AI Overview a year ago; they now appear on roughly
43-48%, so the default is 45%. Migration 00155 moves rows stored at the
old default to the new one and leaves any other rate alone. The example
env, the seed's demo volumes and the docs follow, and a test pins the
default and the override.

An install that sets AI_VOLUME_MULTIPLIER=0.15 itself, as the example
env did, keeps analyzing at 15% until it is changed to 0.45 or removed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
cihan-gyk added a commit to cihan-gyk/ansvisor that referenced this pull request Oct 16, 2026
ansvisor#1103 raises the default AI adoption rate from 15% to 45%, which triples
every estimate. The High Opportunity thresholds move with it, from 500
and 1,000 to 1,500 and 3,000, so the list keeps about the same share of
prompts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cihan-gyk cihan-gyk changed the title fix(volumes): estimate a prompt's volume from the median of its keywords fix(volumes): estimate prompt volume from the median of its keywords at a 45% AI adoption rate Oct 16, 2026
@cihan-gyk

Copy link
Copy Markdown
Collaborator Author

@gkhngyk added a second commit: the default AI adoption rate goes from 15% to 45% (AI Overviews now show on ~43–48% of Google searches), with migration 00155 moving rows stored at 0.15. If the live server sets AI_VOLUME_MULTIPLIER=0.15 (as .env.example did), please change it to 0.45 or remove it when deploying, or new analyses keep writing 15%. #1104 scales High Opportunity to 1,500 / 3,000 to match.

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, approving. 00154 and 00155 are applied on production, matching a rolled-back dry run first. Across all 2,745 rows the total estimated AI volume goes from 39.7M to 8.7M, the average prompt from 14.5k to 3.2k and the median from 2.8k to 720, and every row is now at 0.450. The JS median and rounding match percentile_cont and round. On the tree merged with main and #1104/#1105, schema.sql matches build-schema.sh and server tests pass (1293). One limit for a follow-up: broad categories still read high, e.g. three of an e-bike prompt's five keywords are Google's same 1.5M cluster, so its median stays 1.5M (675k at 45%).

@gkhngyk
gkhngyk merged commit fc30873 into ansvisor:main Oct 17, 2026
5 checks passed
gkhngyk pushed a commit that referenced this pull request Oct 17, 2026
…gh Opportunity (#1104)

* fix(prompts): count each keyword once in Similar Topics and retune High Opportunity

Goes with the median-based prompt volume (fix/prompt-volume-median,
migration 00154).

- Similar Topics added a keyword's volume once for every prompt that used
  it, so "seo tools" (110k a month) in 121 prompts read 13.1M; its
  comment said the opposite. A keyword's volume now counts once, is found
  whatever its case (google_volumes keeps the provider's spelling), and a
  prompt listing it twice counts once. Each prompt in a cluster carries
  its own volumes.
- High Opportunity Prompts listed prompts from 5k and called 10k High,
  which suited the old sum. With the median they are 500 and 1,000
  (lib/prompt-volume-opportunity.ts), keeping about the same share of
  prompts on the list.
- Avg. AI Volume is rounded (it read "632.667"), "across N keywords"
  counts distinct keywords, and the footnote, the Similar Topics totals
  and the MCP get_prompt_volumes description say how the figures are made.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(prompts): scale High Opportunity to the 45% AI adoption rate

#1103 raises the default AI adoption rate from 15% to 45%, which triples
every estimate. The High Opportunity thresholds move with it, from 500
and 1,000 to 1,500 and 3,000, so the list keeps about the same share of
prompts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Cihan <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
gkhngyk pushed a commit that referenced this pull request Oct 17, 2026
…scale (#1105)

A topic opportunity's impact came from its suggestions' estimated volumes
added up: high from 50k a month, medium from 10k. The model estimates
those against the brand's tracked prompts, and with #1103 (the median of
the keywords at a 45% AI adoption rate instead of their sum at 15%) a
brand's average prompt reads about a fifth of what it did. High is now
10k and medium 2k.

Co-authored-by: Cihan <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-migration Adds or edits a migration — apply it to the hosted database

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants