Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

deep-voting-examples

Small, self-contained examples that go with the attribution-based-control.ai Chapter II tutorial. Each section of the chapter is one directory with one script. cd into it, run the script, and the output matches the chapter line for line.

No dependencies beyond Python's standard library.

Sections

  • section1_ngram_basic/ — trigram counts, next-word probabilities. ~30 lines.
  • section2_ngram_attribution/ — the same trigram counter, now keyed per author so each prediction comes with a per-author credit breakdown.

More sections will land here as the chapter grows.

Run

python3 section1_ngram_basic/ngram_toy.py
python3 section2_ngram_attribution/ngram_toy.py

data

data/ holds shakespeare.txt (~1.1 MB) and tinystories.txt (~1.4 MB), used by later sections that actually train a language model. Sections 1 and 2 don't touch it — they use a 5-document movie corpus that lives inline in the script.

About

Companion code for attribution-based-control.ai/deep-voting-book.html

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages