Exa
Back to demo

Research Map — How It Works

Build an AI-powered hypothesis explorer that intelligently maps connections between research papers using Exa search and TF-IDF similarity.

1

Neural Paper Discovery

When you enter a hypothesis, we send it to Exa's neural search endpoint with type: "neural" and category: "research paper". Unlike keyword search, Exa converts your hypothesis into an embedding vector and finds papers whose meaning is semantically close — even if they use completely different terminology.

TypeScript
const res = await fetch("https://api.exa.ai/search", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "x-api-key": process.env.EXA_API_KEY,
  },
  body: JSON.stringify({
    query: hypothesis,
    numResults: 12,
    type: "neural",
    useAutoprompt: true,
    category: "research paper",
    contents: {
      text: { maxCharacters: 1200 },
      highlights: { numSentences: 3, highlightsPerUrl: 2 },
    },
  }),
});

Exa returns 12 papers with their full text excerpts and AI-extracted highlights. This text content is what powers the similarity computation in Step 2.

2

TF-IDF Similarity Scoring

We compute how similar every pair of papers is using TF-IDF (Term Frequency–Inverse Document Frequency) cosine similarity on the paper text returned by Exa. This is a standard information retrieval technique that identifies which papers share rare, meaningful terminology.

How it works: Each paper becomes a vector where each dimension represents a word. Common words like "study" or "results" get low weights. Rare, specific terms like "BRCA1" or "checkpoint-inhibitor" get high weights. The cosine of the angle between two paper vectors gives their similarity score (0.0 = unrelated, 1.0 = identical focus).

Math
TF-IDF(word, paper) = (1 + log(TF)) × log(N / DF)

cosine_similarity(A, B) = (A · B) / (|A| × |B|)

With 12 papers → 66 possible pairs, each scored 0.0–1.0

The similarity computation happens entirely server-side with zero additional API calls. The paper text comes from Exa, so the data is still grounded in Exa's neural index.

3

Claude Categorization + Synthesis

We send the paper list to Claude Sonnet, which performs two tasks:

Categorization: Each paper is classified as Foundational (seminal/background work), Supporting (directly tests the hypothesis), or Emerging (recent cutting-edge work). This determines each node's ring on the map.

Synthesis: Claude writes a 3-4 sentence summary of what the collective evidence says about your hypothesis — saving you from reading 12 abstracts.

Claude does NOT determine the map connections. Edges are purely data-driven from TF-IDF. Claude's role is interpretive (categorization + synthesis), not structural.

4

Force-Directed Visualization

The frontend renders an interactive force-directed graph where every visual property encodes data:

Edge thickness (1–4.5px) reflects similarity score. Edge color fades from grey (weak) to vivid blue (strong). Node position is determined by physics simulation — connected papers pull toward each other, so related work naturally clusters. Clicking a node dims everything except its direct connections.