← Projects

/projects/goodreads-ai-review-summaries/

Goodreads AI Review Summaries

How do you retrieve a useful cross-section of opinion from millions of reviews without loading multi-gigabyte datasets into an application?

  • shell scripting
  • POSIX utilities
  • jq
  • grep
  • gzip
  • JSONL
  • LLM CLI
  • retrieval-augmented generation

Overview

A lightweight retrieval-and-summarization tool implemented as a shell script over the public Goodreads dataset. Given a title, it finds matching editions, gathers their reviews, and asks an LLM to synthesize a concise view of reader sentiment.

Input

  • Compressed book metadata
  • Compressed Goodreads reviews
  • Title-prefix query

Processing

  • Resolve every matching edition ID
  • Stream matching reviews and select up to 20 texts
  • Send the bounded context to an LLM

Output

  • Two-to-three-sentence review summary

Problem

The source data contains about 2.3 million book records and 15.7 million reviews in multi-gigabyte, gzip-compressed JSON Lines files. A title can also have many hardcover, paperback, audio, and translated editions, so querying one book ID would miss much of the available discussion.

Approach

The pipeline prefix-matches the requested title against streamed book metadata, extracts every matching book ID, and builds an alternation pattern for a second streaming pass over the review corpus. It counts all retrieved reviews but bounds the LLM context to at most 20 review texts before requesting a two-to-three-sentence summary.

Technical Implementation

Implemented with a portable shell entry point and standard data-processing tools: zcat streams compressed JSONL, grep performs title and ID retrieval, jq extracts identifiers and review text, and wc and head count and bound the result. Each run works inside a mktemp directory, handles empty book or review matches explicitly, invokes the llm CLI, and removes its intermediate files afterward.

Evaluation & Results

The documented example for The Name of the Wind resolves 35 editions and retrieves 5,992 matching reviews before summarizing a sample of 20. That demonstrates the multi-edition retrieval path, but the project does not include an automated factuality or representativeness evaluation for the generated summary.

What I Learned

For large compressed corpora, retrieval can remain useful without a database when the workflow is narrow and sequential. The important tradeoff is that limiting context keeps inference small and predictable, but a first-20 sample cannot guarantee a statistically representative summary of every matching review.

View repository on GitHub