Contents
Contents
Tap any chapter to start reading.
Chapter 1 Topic ModelsFrom bag-of-words to LDA: discovering latent themes in corpora of tweets, earnings calls, and news headlines. Coherence, perplexity, choosing K, and reading topics as financial-market signals.
Chapter 2 Sentiment AnalysisLexicon-based scoring (Loughran–McDonald, VADER), supervised classifiers, and transformer-based sentiment (FinBERT, RoBERTa). Building sentiment indices from Twitter and earnings calls; predicting returns and economic surprises.
Chapter 3 Large Language Models for Social MediaTokenization, embeddings, attention — how LLMs read text. Using pretrained models for classification, semantic search, and zero-shot tagging of social-media content. Prompting patterns, RAG, and evaluating LLM outputs at scale.
Chapter 4 Information Cascades and ViralityRetweet trees, structural virality (Goel et al. Wiener index), Independent Cascade and Linear Threshold models, empirical power laws in cascade size, influencer detection beyond degree, SIR temporal dynamics, virality prediction.
Chapter 5 Multimodal Analysis — Text, Image, and VideoImages as tensors, convolution from scratch, CNN intuition, CLIP joint embeddings with InfoNCE, vision-language models (BLIP, LLaVA, GPT-4o), audio spectrograms and MFCCs, multimodal content-moderation pipelines.
Chapter 6 Misinformation and Stance DetectionWardle–Derakhshan taxonomy, linguistic-feature classifiers, TF-IDF + logistic regression, FNC-1 stance detection, network propagation signatures, domain reputation, transformer-based detection, RAG for claim verification, hybrid detectors.
Chapter 7 LLM Agents for Content OperationsFrom chat to agent: planning, tool use, memory. ReAct, Chain-of-Thought, Tree-of-Thoughts, ReWoo. Multi-agent systems, agent benchmarks (GAIA, AgentBench), prompt-injection defenses, a content-moderation agent end-to-end.
Chapter 8 Synthetic Content and Deepfake DetectionGeneration taxonomy (diffusion, GANs, voice clones, video), DetectGPT and watermarking, FFT spectral fingerprints, face/audio/video forensics, C2PA provenance, the detection-ceiling result, multi-modality late-fusion detector.
Chapter 9 Foundation Models — Adaptation, Alignment, and DeploymentLoRA, QLoRA, full-vs-PEFT fine-tuning, RLHF and the closed-form DPO derivation, Constitutional AI / RLAIF, distillation, INT8/INT4 quantization, vLLM / Llama.cpp / Ollama / MLX deployment, end-to-end brand-voice fine-tuning case study.
How to read this book
Every Python code block in this book runs live in your browser. Click into any cell, edit it, press the ▶ Run button, and see the output. The Python engine downloads once on the first chapter — after that, everything is instant.
- Chapter 1 (topic models) and Chapter 2 (sentiment) are independent — read in either order.
- Chapter 3 (LLMs) assumes you already understand how text is represented numerically; if you skip Chapter 1, at least skim the bag-of-words and embedding sections.
- The companion book Hands-On Large Language Models (Alammar & Grootendorst) is the reference for Chapter 3 — chapter numbers roughly match.
- Each chapter ends with a small case study: build a sentiment index, train a topic model on Reuters headlines, fine-tune a classifier on labeled tweets.