1 of 65

10-405/605/805�ML FROM LARGE DATASETS

2 of 65

Outline

  • About the course
  • History of big data and ML
  • Asymptotic complexity and cost of operations

​

3 of 65

10-605 ± 200�ADMINISTRIVIA

4 of 65

Who/Where/When

  • Main course page: https://10605.github.io/
    • Lectures posted/updated as we go
  • Lectures: Mon-Wed 3:30-4:50pm in TEP 1403
    • Recitation: Fri 3:30-4:50pm in TEP 1403
  • Lectures will be record and posted on-line
    • but not livestreamed
    • we can’t guarantee when they will be posted
  • There will be an on-line quiz you should do soon after lecture
    • It closes after 48 hours
    • We have one today
    • They don’t count for a lot but there are no makeups
      • Quizzes reinforce the lecture
      • And make sure you keep up!

​

​

​

 

5 of 65

Who/Where/When

  • William W. Cohen
    • 1990-mid 1990’s: AT&T Bell Labs (working on various things, including scalable rule-learning systems)
    • Mid 1990’s—2000: AT&T Research (text classification, data integration, knowledge-as-text, information extraction)
    • 2000-2002: Whizbang! Labs (info extraction from Web startup located in Pittsburgh)
    • 2002-May 2018: CMU (IE, scientific text, social networks, graph learning, structure output learning, …)
      • 2008-2009, Jan-Jul 2017: Visiting Scientist at Google
      • 2012: Started teaching 10-605 Learning from Large Datasets
    • May 2018-March 2024: Google (QA, neural reasoning, memory-augmented neural networks, image generation, prediction-powered inference, …)
      • Part-time at CMU
      • 2018: Stopped teaching 10-605 Learning from Large Datasets
    • May 2024-now: CMU again
      • Still part-time at Google
    • This course will mostly follow more recent versions of 405/605/805
      • There is a trail on the website to previous versions I taught back in the day

​

​

6 of 65

Who/Where/When

  • William W. Cohen
    • 1990-mid 1990’s: AT&T Bell Labs (working on various things, including scalable rule-learning systems)
    • Mid 1990’s—2000: AT&T Research (text classification, data integration, knowledge-as-text, information extraction)
    • 2000-2002: Whizbang! Labs (info extraction from Web startup located in Pittsburgh)
    • 2002-May 2018: CMU (IE, scientific text, social networks, graph learning, structure output learning, …)
      • 2008-2009, Jan-Jul 2017: Visiting Scientist at Google
      • 2012: Started teaching 10-605 Learning from Large Datasets
    • May 2018-March 2024: Google (QA, neural reasoning, memory-augmented neural networks, image generation, prediction-powered inference, …)
      • Part-time at CMU
      • 2018: Stopped teaching 10-605 Learning from Large Datasets
    • May 2024-now: CMU again
      • Still part-time at Google
      • 3rd time teaching 10-x05 since then
      • There is a trail on the website to previous versions I taught back in the day

​

​

7 of 65

Who/Where/When

  • Jacob Rast
    • Staff member in the Machine Learning Department
    • 7th semester on the course
    • Enjoys traveling and studying foreign language (中文HSK6级, Deutsch CEFR A2+)
    • Likes working with genomics datasets, programming autograders, playing with electronics, and training small language models.
    • Enrolled in 10-703 and (hopefully) 36-700 this semester

​

8 of 65

Who/Where/When

  • Yuteng Zhang
    • Second-year MCDS student
    • Took 10-605 in F25
    • First time TA this course
    • Interested in AI Agents and VLMs
    • Enjoys traveling and board games
    • Recently working on frontend component recognition and code review
    • Returns 31st of August

9 of 65

Who/Where/When

  • Gati Aher
    • 4th year MLD/HCI PhD student
    • First time TAing this course
    • Researching LLM Creativity
    • Interested in LLMs / chatbots for Project-Based Learning
    • Likes drawing and board games :)
    • Recently worked with a Massive Online Course dataset

10 of 65

Who/Where/When

  • Siyuan Chen
  • 4th year CSD PhD student
  • Took 10-605 in F23
  • First time TAing this course
  • Research in System for ML
  • Interested in efficient ML
  • Return Aug 29th

11 of 65

Who/Where/When

  • Akshan Agrawal
    • Second-year MSCS student
    • Took 10-605 in F25
    • First time TAing this course
    • Research on enhancing VLMs’ understanding of the 3D world (basically, giving AI a “Spidey-sense” for its surroundings :-))
    • Currently working with 3D Visual Grounding datasets
    • Loves exploring nature (who doesn’t?)
    • Returning on the morning of August 24th (hopefully, I’ll see you all on the first day of class!🤞)

12 of 65

Who/Where/When

  • Aditya Gupta
    • Final-year MSCS student
    • Took 10605 in Fall’25
    • First time TA’ing
    • Research on Adaptive Tokenization using RL
    • Generally interested in efficient ML
    • Enjoy hiking and travelling, mountains>>
    • Returning Aug 26th

13 of 65

Who/Where/When

  • Xueying Ding
    • Fifth year PhD student
    • First time TA’ing this course
    • Research on post-training foundation models and LLMs
    • Generally interested in training/inference efficiency for LLMs, building agents for tabular data, recommendation systems, search and etc.

​

14 of 65

What/How

  • Programming Languages and Systems:
    • Python, PySpark, Polars, PyTorch
  • Resources:
    • Amazon Elastic Cloud
      • Amazon EC2 [http://aws.amazon.com/ec2/]

​

​

​

15 of 65

What/How: cheating vs working together

  • We have a long and explicit policy
    • see the syllabus
    • tl;dr: transmit information like they did in the stone age, brain-to-brain, and document it
    • do not copy anything digitally
    • exceptions (eg projects) will be explicitly stated
  • “Handled severely” … ?
    • everybody involved will fail the course by default
    • every infraction always gets reported up to the Office of Academic Integrity, the head of your program, the dean of your school, ….
    • a second offense is very bad

​

​

​

​

​

​

16 of 65

What/How: using GenAI

  • GenAI makes doing things easier
    • and learning things hard
  • Unless we say otherwise a chatbot is treated like a collaborator
    • tl;dr: ask whatever you want but do not copy anything directly
      • never cut and paste, or even copy-by-typing from another screen
      • copy by writing with a pen/pencil is ok
      • put it in your brain and then take it out when you are generating the text/code
  • Enforcement
    • MOSS with chatbot seeds, etc
    • Writing sessions: short in-class quizzes
      • our goal: sessions are easy if you did the work

​

​

​

​

​

​

​

17 of 65

What/How: SlotA/SlotB and GenAI

  • GenAI makes doing things easier
    • and learning things hard
    • but sometimes it helps
  • New idea (from Matt Gormley)
    • Slot A (what we did in F25):
      • Submit your GenAI-free assignment as usual
      • Review and do the writing session quiz

​

    • Slot B:
      • Team up with GenAI and make it better
      • Resubmit if you want!
        • get the max score for each question in slot A, slot B

​

​

​

​

      • Get a 10% bonus if slot A grade > 50%

​

18 of 65

What/How: SlotA/SlotB and GenAI

  • Slot A is optional … but
    • the writing session is not
    • we do curve the grades
  • Slot B is definitely optional
    • assignments should NOT need GenAI
    • (mostly) skipping slot B and getting started on next assignment is an excellent strategy
    • to encourage that:
      • Slot A grades out within 3-4 days
      • Slot B grades due 3 days after that

​

​

​

19 of 65

Why can’t you use GenAI more?

Humans learn much more by doing than by watching

20 of 65

Outline

  • About the course
  • History of big data and ML
  • Asymptotic complexity and cost of operations

​

21 of 65

BIG DATA HISTORY

22 of 65

Big ML c. 1993 (Cohen, “Efficient…Rule Learning”, IJCAI 1993)

​

​

talk_announcement :- WORDS ~ talk, WORDS ~ Subject_talk (54/1).

talk_announcement :- WORDS ~ '2d416' (26/3).

talk_announcement :- WORDS ~ system, WORDS ~ 'To_1126@research' (4/0).

talk_announcement :- WORDS ~ mh, WORDS ~ time (5/1).

talk_announcement :- WORDS ~ talk, WORDS ~ used (3/0).

talk_announcement :- WORDS ~ presentations (2/1).

default non_talk_announcement (390/1).

" :-" means "if", "~" means "contains"

23 of 65

How do we use very large amounts of data?

  • Working with big data is not about
    • code optimization
    • learning details of todays hardware/software:
      • Hadoop, Spark, Apache Beam, Polar, JAX, PyTorch, ….
  • Working with big data is about
    • Understanding what the tools that are available offer
    • Understanding how much can be accomplished with linear or nearly-linear operations
    • Understanding how to organize your computations so that they effectively use whatever’s fast
    • Understanding how to test/debug/verify with large data

*

* according to William

24 of 65

Big ML c. 1993 (Cohen, “Efficient…Rule Learning”, IJCAI 1993)

25 of 65

Why is the method slow for noisy data?

Algorithm

  • Fit the data: POS,NEG
  • While POS isn’t empty:
    • Let R be “pos 🡨 True”
    • While R matches any examples in NEG:
      • Pick the “best” condition c of the form “xi=True” or “xi=false”
      • Add c to the antecedent of R
    • Add R to the rule set
    • Remove examples that satisfy R from POS
  • Prune the rule set

​

​

​

Asymptotic Analysis

  • The total number of iterations of L1 is the number of conditions in the rule set (before pruning) – call it m
  • Picking the “best” condition requires looking at all examples – say there are n of these
  • Time is at least m*n
  • The problem:
    • When there are noisy positive examples, the algorithm builds rules that cover just 1-2 of them
      • Because noise is incompressible!
      • So m=O(n)
    • So with huge noisy datasets you build huge rulesets

L1

quadratic

talk_announcement :- WORDS ~ talk, WORDS ~ Subject_talk, WORDS ~ p_comma (52/0).

talk_announcement :- WORDS ~ '2d416', WORDS ~ be (19/0). (54/1)

talk_announcement :- WORDS ~ show, WORDS ~ talk (7/0).

talk_announcement :- WORDS ~ mh, WORDS ~ time, WORDS ~ research (4/0).

talk_announcement :- WORDS ~ system, WORDS ~ 'To_1126@research' (3/0).

talk_announcement :- WORDS ~ '2d416', WORDS ~ memory (3/0).

talk_announcement :- WORDS ~ interfaces, WORDS ~ From_p_exclaim_point (2/0).

talk_announcement :- WORDS ~ presentations, WORDS ~ From_att (2/0).

default non_talk_announcement .

26 of 65

So in early-mid 1990’s…..

  • Many commonly used algorithms were asymptotically “slow”
  • Experimental datasets were small
  • Not many people really cared

​

​

​

​

27 of 65

28 of 65

Big ML c. 2001 (Banko & Brill, “Scaling to Very Very Large Corpora …)

Task: distinguish pairs of easily-confused words (“affect” vs “effect”) in context

29 of 65

Why does more data help?

  • Let's dig into affect/effect classification with a large dataset – Google books n-grams
    • All 5-grams that appear >= 40 times in a corpus of 1M English books
      • approx 80B words

​

30 of 65

Why More Data Helps: A Demo

  • Data: Google Book n-grams
    • All 5-grams that appear >= 40 times in a corpus of 1M English books
      • approx 80B words
      • 5-grams: 30Gb compressed, 250-300Gb uncompressed
      • Each 5-gram contains frequency distribution over years
    • Wrote code to compute
      • Pr(A,B,C,D,E|C=affect or C=effect)
      • Pr(any subset of A,…,E|any other fixed values of A,…,E with C=affect V effect)
    • Demo: …

​

​

FineWeb is 15 trillion tokens, ~180x bigger

31 of 65

Why More Data Helps

Observations [from playing with data]:

    • Mostly effect not affect
    • Most common word before affect is not, before effect is the
    • If you've written "no affect" it's probably wrong
    • …

​

​

​

32 of 65

So in 2001…..

  • We’re learning:
    • “there’s no data like more data”
    • For many tasks, there’s no real substitute for using lots of data

33 of 65

…and in 2009

Eugene Wigner’s article “The Unreasonable Effectiveness of Mathematics in the Natural Sciences” examines why so much of physics can be neatly explained with simple mathematical formulas such as f = ma or e = mc2. Meanwhile, sciences that involve human beings rather than elementary particles have proven more resistant to elegant mathematics. Economists suffer from physics envy over their inability to neatly model human behavior. An informal, incomplete grammar of the English language runs over 1,700 pages.

​

Perhaps when it comes to natural language processing and related fields, we’re doomed to complex theories that will never have the elegance of physics equations. But if that’s so, we should stop acting as if our goal is to author extremely elegant theories, and instead embrace complexity and make use of the best ally we have: the unreasonable effectiveness of data.

Norvig, Pereira, Halevy, “The Unreasonable Effectiveness of Data”, 2009

34 of 65

Bengio, Foundations & Trends, 2009

35 of 65

1M vs 10M

labeled examples

2.5M examples for “pretraining”

36 of 65

SCALING LAWS FOR LLMS

37 of 65

History of LLMs

  • Word2vec, Mikolov et al, 2013: ‘skip-gram language model’ trained on 1B word corpus
    • 46,000+ citations on Google Scholar
  • ELMo – Peters et al 2018: embeddings from biLSTM LMs, trained on 1B word corpus, error reductions of 6-20% on multiple tasks
    • 16,000+ citations
  • BERT - Devlin et al 2019: Transformer-based encoder-only model, trained on 3.3B word corpus
    • 122,000+ citations
  • GPT-2 – OpenAI, 2019: Decoder-only model, about 6B parameters
  • T5 – Google: about 11B parameters
  • GPT-3 – OpenAI, 2020, 137B parameters
  • …

Models got bigger and bigger

38 of 65

Chinchilla Scaling Laws

2022

39 of 65

Chinchilla Scaling Laws

Main idea: better model joint distribution of model size (# parameters), model performance (test set loss / perplexity), and training cost (floating point operations, aka FLOPS)

​

40 of 65

Chinchilla Scaling Laws

63B

1.4T

Constraint = Budget = $$

Idea: fit a simple model to the data that relates compute, parameters, and loss, and use that to optimize loss given a total compute budget.

41 of 65

Chinchilla Scaling Laws

MMLU

42 of 65

Compute Scaling Laws = Data Scaling Laws

Nowadays mostly distinct tokens

Llama 1 (2023) training mixture

43 of 65

Compute Scaling Laws = Data Scaling Laws

Llama 1 (2023) training mixture

7B params: 200B 🡪 1T toks

1B toks: 7B🡪33B params

44 of 65

IS BIG DATA ALL YOU NEED?

45 of 65

The Joint Density

  • Data:
    • All 5-grams that appear >= 40 times in a corpus of 1M English books
      • approx 80B words
      • 5-grams: 30Gb compressed, 250-300Gb uncompressed
      • Each 5-gram contains frequency distribution over years
    • Wrote code to compute
      • Pr(A,B,C,D,E|C=affect or C=effect)
      • Pr(any subset of A,…,E|any other fixed values of A,…,E with C=affect V effect)
  • Observations [from playing with data]:
    • Mostly effect not affect
    • Most common word before affect is not
    • After not effect most common word is a
    • …

​

​

​

46 of 65

The Joint Can Be Used To Implement A Classifier

46

 

 

The joint density:

A classifier for C based on the joint density estimator:

and predict

 

47 of 65

An experiment: how useful is that classifier?

  • Extracted all affect/effect 5-grams from an old Reuters corpus
    • about 20k documents
    • about 723 n-grams, 661 distinct
    • Financial news, not novels or textbooks
  • Tried to predict center word with:
    • Pr(C|A=a,B=b,D=d,E=e)

5% error

Of 723 examples:

  • 622 have no data for a,b,d,e (!)
  • Of the 101 that do have data
    • 100 predictions are correct
    • only 1 is wrong

Naïve Bayes

48 of 65

An experiment: how useful is that classifier? (Is big data all you need?)

  • Extracted all affect/effect 5-grams from an old Reuters corpus
    • about 20k documents
    • about 723 n-grams, 661 distinct
    • Financial news, not novels or textbooks
  • Tried to predict center word with:
    • Pr(C|A=a,B=b,D=d,E=e)
    • then Pr(C|A=a,B=b,D=d)
    • then Pr(C|B=b,D=d)
    • then Pr(C|B=b)
    • then Pr(C)

​

Pattern

Used

Errors

P(C|A,B,D,E)

101

1

P(C|A,B,D)

157

6

P(C|B,D)

163

13

P(C|B)

244

78

P(C)

58

31

17.8% error

49 of 65

What’s more naïve than a big table of counts?

49

 

The (brute force) joint density estimator:

The naïve estimator assumes independence:

 

 

50 of 65

A “naïve” but useful estimate of joint probability

50

If you want to use this to predict C you can’t assume everything is independent of C….so….

 

 

 

and predict

 

51 of 65

Naïve Bayes refinement - 1

51

In n-grams we look at Pr(b)=Pr(second word is “b”), etc.

​

For long documents you usually don’t keep track of where a word appears, so:

 

 

“Multinomial naïve Bayes”

52 of 65

Naïve Bayes refinement - 2

52

For numeric stability it’s best to compute with logs:

 

 

53 of 65

Naïve Bayes refinement - 3

53

You also usually smooth the estimates:

​

​

 

where V is the number of words.

​

(But for Pr(y), use the number of classes instead of V).

​

​

This is usually a terrible density estimator but often is a pretty good classifier!

54 of 65

Classification vs Density Estimation

Classification

Density Estimation

55 of 65

Is Big Data All You Need?

* joint

56 of 65

Outline

  • About the course
  • History of big data and ML
    • Language models
  • Asymptotic complexity and cost of operations

​

57 of 65

SCALING LAWS FOR LLMS

58 of 65

History of LLMs

  • Word2vec, Mikolov et al, 2013: ‘skip-gram language model’ trained on 1B word corpus
    • 46,000+ citations on Google Scholar
  • ELMo – Peters et al 2018: embeddings from biLSTM LMs, trained on 1B word corpus, error reductions of 6-20% on multiple tasks
    • 16,000+ citations
  • BERT - Devlin et al 2019: Transformer-based encoder-only model, trained on 3.3B word corpus, 110M parameters
    • 122,000+ citations
  • GPT-2 – OpenAI, 2019: about 6B parameters
  • T5 – Google, 2019: about 11B parameters
  • GPT-3 – OpenAI, 2020, ~ 137B parameters
  • Kimi K3 – Moonshot, 2026 ~ 2,800B parameters
  • …

Models got bigger and bigger

59 of 65

Chinchilla Scaling Laws

2022

60 of 65

Chinchilla Scaling Laws

Main idea: better model joint distribution of model size (# parameters), model performance (test set loss / perplexity), and training cost (floating point operations, aka FLOPS)

​

61 of 65

Chinchilla Scaling Laws

63B

1.4T

Constraint = Budget = $$

Idea: fit a simple model to the data that relates compute, parameters, and loss, and use that to optimize loss given a total compute budget.

62 of 65

Chinchilla Scaling Laws

MMLU

63 of 65

Compute Scaling Laws = Data Scaling Laws

Nowadays mostly distinct tokens

Llama 1 (2023) training mixture

64 of 65

Compute Scaling Laws = Data Scaling Laws

Llama 1 (2023) training mixture

7B params: 200B 🡪 1T toks

1B toks: 7B🡪33B params

65 of 65

Outline

  • About the course
  • History of big data and ML
  • Asymptotic complexity and cost of operations
    • we stopped HERE on Monday

​