Skip to content

Commit

Permalink
v1 of Alignment chapter
Browse files Browse the repository at this point in the history
  • Loading branch information
souzatharsis committed Dec 15, 2024
1 parent 86ae400 commit 3f9d131
Show file tree
Hide file tree
Showing 38 changed files with 1,627 additions and 451 deletions.
Binary file modified tamingllms/_build/.doctrees/environment.pickle
Binary file not shown.
Binary file modified tamingllms/_build/.doctrees/notebooks/alignment.doctree
Binary file not shown.
Binary file modified tamingllms/_build/.doctrees/notebooks/evals.doctree
Binary file not shown.
Binary file modified tamingllms/_build/.doctrees/notebooks/output_size_limit.doctree
Binary file not shown.
Binary file modified tamingllms/_build/.doctrees/notebooks/structured_output.doctree
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tamingllms/_build/html/_images/dpo_paper.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tamingllms/_build/html/_images/instruct.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tamingllms/_build/html/_images/openai_rlhf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
312 changes: 257 additions & 55 deletions tamingllms/_build/html/_sources/notebooks/alignment.ipynb

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions tamingllms/_build/html/_static/alignment/alignment_simplified.d2
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Models with consistent styling
Alignment: {
direction: right

base: Base Model {
shape: rectangle
style.fill: "#FFA500"
}

sft: SFT Model {
shape: rectangle
style.fill: "#FFA500"
}

reward: Reward Model {
shape: rectangle
style.fill: "#FFA500"
}

aligned: Aligned Model {
shape: rectangle
style.fill: "#FFA500"
}

# Main flow connections
base -> sft: Human Instructions
sft -> aligned: PPO optimization {
style.stroke-width: 2
}

# Branch to reward model
sft -> reward: Human\npreferences

# Connection from reward to main flow
reward -> aligned: Re-use preference\nprompts
}

direction: right
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
67 changes: 67 additions & 0 deletions tamingllms/_build/html/_static/alignment/instruct.d2
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Main container for models and explanations
models: {
direction: right

base: Base Language Model {
shape: rectangle
style.fill: "#E8F6F3"
style.stroke: "#2ECC71"
}

inst: Instruction-Tuned Model {
shape: rectangle
style.fill: "#FCF3CF"
style.stroke: "#F4D03F"
}

aligned: Aligned Model {
shape: rectangle
style.fill: "#EBF5FB"
style.stroke: "#3498DB"
}

# Main progression
base -> inst -> aligned

# Direct alignment path
base -> aligned: {
style.stroke-dash: 5
}
}

# Notes under models
base_note: Next-Token Prediction {
shape: rectangle
style.fill: "#FFFFFF"
style.stroke: "#2ECC71"
style.stroke-dash: 3
}

inst_note: Task-Specific {
shape: rectangle
style.fill: "#FFFFFF"
style.stroke: "#F4D03F"
style.stroke-dash: 3
}

aligned_note: Human Preference-Aligned {
shape: rectangle
style.fill: "#FFFFFF"
style.stroke: "#3498DB"
style.stroke-dash: 3
}

# Connect models to notes
models.base -> base_note: {
direction: down
}

models.inst -> inst_note: {
direction: down
}

models.aligned -> aligned_note: {
direction: down
}

direction: right
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tamingllms/_build/html/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@

<li class="toctree-l1 ">

<a href="notebooks/alignment.html" class="reference internal ">Safety and Alignment</a>
<a href="notebooks/alignment.html" class="reference internal ">Preference-Based Alignment</a>



Expand Down
2 changes: 1 addition & 1 deletion tamingllms/_build/html/markdown/intro.html
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@

<li class="toctree-l1 ">

<a href="../notebooks/alignment.html" class="reference internal ">Safety and Alignment</a>
<a href="../notebooks/alignment.html" class="reference internal ">Preference-Based Alignment</a>



Expand Down
2 changes: 1 addition & 1 deletion tamingllms/_build/html/markdown/toc.html
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@

<li class="toctree-l1 ">

<a href="../notebooks/alignment.html" class="reference internal ">Safety and Alignment</a>
<a href="../notebooks/alignment.html" class="reference internal ">Preference-Based Alignment</a>



Expand Down
526 changes: 375 additions & 151 deletions tamingllms/_build/html/notebooks/alignment.html

Large diffs are not rendered by default.

88 changes: 44 additions & 44 deletions tamingllms/_build/html/notebooks/evals.html

Large diffs are not rendered by default.

62 changes: 31 additions & 31 deletions tamingllms/_build/html/notebooks/output_size_limit.html

Large diffs are not rendered by default.

82 changes: 41 additions & 41 deletions tamingllms/_build/html/notebooks/structured_output.html

Large diffs are not rendered by default.

Binary file modified tamingllms/_build/html/objects.inv
Binary file not shown.
2 changes: 1 addition & 1 deletion tamingllms/_build/html/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@

<li class="toctree-l1 ">

<a href="notebooks/alignment.html" class="reference internal ">Safety and Alignment</a>
<a href="notebooks/alignment.html" class="reference internal ">Preference-Based Alignment</a>



Expand Down
2 changes: 1 addition & 1 deletion tamingllms/_build/html/searchindex.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tamingllms/_build/jupyter_execute/markdown/intro.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "47492779",
"id": "83bbc8a2",
"metadata": {},
"source": [
"(intro)=\n",
Expand Down
312 changes: 257 additions & 55 deletions tamingllms/_build/jupyter_execute/notebooks/alignment.ipynb

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion tamingllms/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ sphinx:
extra_extensions:
- sphinxcontrib.mermaid
config:
mathjax_path: https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
bibtex_reference_style: author_year
html_theme: 'press' #insipid
#html_logo: '_static/logo_w.png'
Expand All @@ -49,4 +50,5 @@ sphinx:
#html_sidebars: {'**': ['globaltoc.html']}
html_theme_options:
external_links:
- ["Github", "https://github.com/souzatharsis/tamingllms"]
- ["Github", "https://github.com/souzatharsis/tamingllms"]

38 changes: 38 additions & 0 deletions tamingllms/_static/alignment/alignment_simplified.d2
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Models with consistent styling
Alignment: {
direction: right

base: Base Model {
shape: rectangle
style.fill: "#FFA500"
}

sft: SFT Model {
shape: rectangle
style.fill: "#FFA500"
}

reward: Reward Model {
shape: rectangle
style.fill: "#FFA500"
}

aligned: Aligned Model {
shape: rectangle
style.fill: "#FFA500"
}

# Main flow connections
base -> sft: Human Instructions
sft -> aligned: PPO optimization {
style.stroke-width: 2
}

# Branch to reward model
sft -> reward: Human\npreferences

# Connection from reward to main flow
reward -> aligned: Re-use preference\nprompts
}

direction: right
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tamingllms/_static/alignment/dpo_paper.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
67 changes: 67 additions & 0 deletions tamingllms/_static/alignment/instruct.d2
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Main container for models and explanations
models: {
direction: right

base: Base Language Model {
shape: rectangle
style.fill: "#E8F6F3"
style.stroke: "#2ECC71"
}

inst: Instruction-Tuned Model {
shape: rectangle
style.fill: "#FCF3CF"
style.stroke: "#F4D03F"
}

aligned: Aligned Model {
shape: rectangle
style.fill: "#EBF5FB"
style.stroke: "#3498DB"
}

# Main progression
base -> inst -> aligned

# Direct alignment path
base -> aligned: {
style.stroke-dash: 5
}
}

# Notes under models
base_note: Next-Token Prediction {
shape: rectangle
style.fill: "#FFFFFF"
style.stroke: "#2ECC71"
style.stroke-dash: 3
}

inst_note: Task-Specific {
shape: rectangle
style.fill: "#FFFFFF"
style.stroke: "#F4D03F"
style.stroke-dash: 3
}

aligned_note: Human Preference-Aligned {
shape: rectangle
style.fill: "#FFFFFF"
style.stroke: "#3498DB"
style.stroke-dash: 3
}

# Connect models to notes
models.base -> base_note: {
direction: down
}

models.inst -> inst_note: {
direction: down
}

models.aligned -> aligned_note: {
direction: down
}

direction: right
Binary file added tamingllms/_static/alignment/instruct.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tamingllms/_static/alignment/openai_rlhf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 3f9d131

Please sign in to comment.