<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[Atlantis’s Substack]]></title><description><![CDATA[My personal Substack]]></description><link>https://roadtoai.substack.com</link><image><url>https://substackcdn.com/image/fetch/$s_!ggA_!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a88c9f8-91ca-4dbd-a19d-bb0c300ca184_144x144.png</url><title>Atlantis’s Substack</title><link>https://roadtoai.substack.com</link></image><generator>Substack</generator><lastBuildDate>Wed, 13 May 2026 07:30:00 GMT</lastBuildDate><atom:link href="https://roadtoai.substack.com/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[Atlantis]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[roadtoai@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[roadtoai@substack.com]]></itunes:email><itunes:name><![CDATA[AI with Atlantis]]></itunes:name></itunes:owner><itunes:author><![CDATA[AI with Atlantis]]></itunes:author><googleplay:owner><![CDATA[roadtoai@substack.com]]></googleplay:owner><googleplay:email><![CDATA[roadtoai@substack.com]]></googleplay:email><googleplay:author><![CDATA[AI with Atlantis]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[Generative AI project lifecycle - Application integration]]></title><description><![CDATA[Notes I took while taking Generative AI with LLMs course]]></description><link>https://roadtoai.substack.com/p/generative-ai-project-lifecycle-application</link><guid isPermaLink="false">https://roadtoai.substack.com/p/generative-ai-project-lifecycle-application</guid><dc:creator><![CDATA[AI with Atlantis]]></dc:creator><pubDate>Fri, 11 Oct 2024 15:57:27 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!Cott!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7309e4db-29da-4324-a87b-b5df597fe599_983x394.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>What to consider to integrate your model into applications</p><ul><li><p>How your LLM will function in deployment</p><ul><li><p>inference speed</p></li><li><p>compute budget</p></li><li><p>trade off model performance for improved inference speed or lower storage?</p></li></ul></li><li><p>Additional resources your model may need</p><ul><li><p>Interaction with external data or other applications? If so, how will you connect to those resources?</p></li></ul></li><li><p>How your model will be consumed</p><ul><li><p>what will the intended application or API interface that your model will be consumed through look like?</p></li></ul></li></ul><h3>Model optimizations to improve application performance</h3><ul><li><p>Reduce the size of the LLM. Challenge: maintaining model performance</p><ul><li><p>Distillation ( Knowledge distillation)</p></li><li><p>Post training quantization</p></li><li><p>Pruning : Reduce model parameters that contribute little to the model performance</p></li></ul></li></ul><h4>Knowledge distillation:</h4><ul><li><p>Total loss = distillation loss + student loss. Distillation loss between soft predictions of teach and student. Student loss hard predictions of student and hard labels (ground truth).</p></li><li><p>In practice, distillation is effective for encoder based models. Not that effective for decoder based generative models.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Cott!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7309e4db-29da-4324-a87b-b5df597fe599_983x394.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Cott!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7309e4db-29da-4324-a87b-b5df597fe599_983x394.png 424w, https://substackcdn.com/image/fetch/$s_!Cott!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7309e4db-29da-4324-a87b-b5df597fe599_983x394.png 848w, https://substackcdn.com/image/fetch/$s_!Cott!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7309e4db-29da-4324-a87b-b5df597fe599_983x394.png 1272w, https://substackcdn.com/image/fetch/$s_!Cott!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7309e4db-29da-4324-a87b-b5df597fe599_983x394.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Cott!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7309e4db-29da-4324-a87b-b5df597fe599_983x394.png" width="983" height="394" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7309e4db-29da-4324-a87b-b5df597fe599_983x394.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:394,&quot;width&quot;:983,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:178713,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Cott!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7309e4db-29da-4324-a87b-b5df597fe599_983x394.png 424w, https://substackcdn.com/image/fetch/$s_!Cott!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7309e4db-29da-4324-a87b-b5df597fe599_983x394.png 848w, https://substackcdn.com/image/fetch/$s_!Cott!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7309e4db-29da-4324-a87b-b5df597fe599_983x394.png 1272w, https://substackcdn.com/image/fetch/$s_!Cott!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7309e4db-29da-4324-a87b-b5df597fe599_983x394.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h4>Post-training Quantization (PTQ)</h4></li><li><p>PTQ transforms model weights into a lower precision representation such 16-bit floating point or 8-bit integer.</p></li><li><p>May result in small model metrics reduction.</p><h4>Pruning</h4></li><li><p>Remove model weights with values close or equal to zero</p></li><li><p>Pruning methods:</p><ul><li><p>Full model -retraining</p></li><li><p>Peft/LoRA</p></li><li><p>Post-training</p></li></ul></li><li><p>In theory, reduces model size and improves model performance</p></li><li><p>In practice, only small % in LLMs are zero-weights</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!S4So!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53bd2bf0-0b53-47e8-ba8b-a1c23f7c876f_844x434.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!S4So!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53bd2bf0-0b53-47e8-ba8b-a1c23f7c876f_844x434.png 424w, https://substackcdn.com/image/fetch/$s_!S4So!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53bd2bf0-0b53-47e8-ba8b-a1c23f7c876f_844x434.png 848w, https://substackcdn.com/image/fetch/$s_!S4So!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53bd2bf0-0b53-47e8-ba8b-a1c23f7c876f_844x434.png 1272w, https://substackcdn.com/image/fetch/$s_!S4So!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53bd2bf0-0b53-47e8-ba8b-a1c23f7c876f_844x434.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!S4So!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53bd2bf0-0b53-47e8-ba8b-a1c23f7c876f_844x434.png" width="844" height="434" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/53bd2bf0-0b53-47e8-ba8b-a1c23f7c876f_844x434.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:434,&quot;width&quot;:844,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:247071,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!S4So!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53bd2bf0-0b53-47e8-ba8b-a1c23f7c876f_844x434.png 424w, https://substackcdn.com/image/fetch/$s_!S4So!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53bd2bf0-0b53-47e8-ba8b-a1c23f7c876f_844x434.png 848w, https://substackcdn.com/image/fetch/$s_!S4So!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53bd2bf0-0b53-47e8-ba8b-a1c23f7c876f_844x434.png 1272w, https://substackcdn.com/image/fetch/$s_!S4So!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53bd2bf0-0b53-47e8-ba8b-a1c23f7c876f_844x434.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h4>Using the LLM in applications</h4><p>Other challenges:</p><ol><li><p>Internal knowledge of model cutoff &#8594; can&#8217;t answer questions related to events after model cutoff</p></li><li><p>LLM do not carry out mathematical calculation on its own</p></li><li><p>Hallucinations</p></li></ol><p>Techniques to overcome this challenges:</p><ul><li><p>RAG: helps with knowledge cutoff and hallucinations</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!q9Xo!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4855049c-df9d-49fe-81e2-fe5d386a554f_833x306.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!q9Xo!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4855049c-df9d-49fe-81e2-fe5d386a554f_833x306.png 424w, https://substackcdn.com/image/fetch/$s_!q9Xo!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4855049c-df9d-49fe-81e2-fe5d386a554f_833x306.png 848w, https://substackcdn.com/image/fetch/$s_!q9Xo!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4855049c-df9d-49fe-81e2-fe5d386a554f_833x306.png 1272w, https://substackcdn.com/image/fetch/$s_!q9Xo!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4855049c-df9d-49fe-81e2-fe5d386a554f_833x306.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!q9Xo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4855049c-df9d-49fe-81e2-fe5d386a554f_833x306.png" width="833" height="306" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4855049c-df9d-49fe-81e2-fe5d386a554f_833x306.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:306,&quot;width&quot;:833,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:84411,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!q9Xo!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4855049c-df9d-49fe-81e2-fe5d386a554f_833x306.png 424w, https://substackcdn.com/image/fetch/$s_!q9Xo!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4855049c-df9d-49fe-81e2-fe5d386a554f_833x306.png 848w, https://substackcdn.com/image/fetch/$s_!q9Xo!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4855049c-df9d-49fe-81e2-fe5d386a554f_833x306.png 1272w, https://substackcdn.com/image/fetch/$s_!q9Xo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4855049c-df9d-49fe-81e2-fe5d386a554f_833x306.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!EfV_!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe795be87-1bb1-4a21-8e55-b73b77dc09fd_670x297.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!EfV_!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe795be87-1bb1-4a21-8e55-b73b77dc09fd_670x297.png 424w, https://substackcdn.com/image/fetch/$s_!EfV_!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe795be87-1bb1-4a21-8e55-b73b77dc09fd_670x297.png 848w, https://substackcdn.com/image/fetch/$s_!EfV_!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe795be87-1bb1-4a21-8e55-b73b77dc09fd_670x297.png 1272w, https://substackcdn.com/image/fetch/$s_!EfV_!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe795be87-1bb1-4a21-8e55-b73b77dc09fd_670x297.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!EfV_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe795be87-1bb1-4a21-8e55-b73b77dc09fd_670x297.png" width="670" height="297" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e795be87-1bb1-4a21-8e55-b73b77dc09fd_670x297.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:297,&quot;width&quot;:670,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:96475,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!EfV_!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe795be87-1bb1-4a21-8e55-b73b77dc09fd_670x297.png 424w, https://substackcdn.com/image/fetch/$s_!EfV_!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe795be87-1bb1-4a21-8e55-b73b77dc09fd_670x297.png 848w, https://substackcdn.com/image/fetch/$s_!EfV_!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe795be87-1bb1-4a21-8e55-b73b77dc09fd_670x297.png 1272w, https://substackcdn.com/image/fetch/$s_!EfV_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe795be87-1bb1-4a21-8e55-b73b77dc09fd_670x297.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div></li><li><p>Data preparations for vector store for RAG</p></li><li><p>Data must fit inside context window ( prompt context limit). Single document too large to fit in window &#8594; split long sources into short chunks.</p></li><li><p>Data must be available in format that allows its relevance to be assessed at inference time: Embedding vectors which are stored in vector stores for efficient identification of semantically related text.</p></li><li><p>Vector databases are a particular implementations of a vector store where each vector is also identified by a key.</p></li></ul><h4>Interacting with external applications</h4><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!JBeF!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b86f2b4-30d1-440a-8e76-f41645778bd6_832x346.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!JBeF!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b86f2b4-30d1-440a-8e76-f41645778bd6_832x346.png 424w, https://substackcdn.com/image/fetch/$s_!JBeF!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b86f2b4-30d1-440a-8e76-f41645778bd6_832x346.png 848w, https://substackcdn.com/image/fetch/$s_!JBeF!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b86f2b4-30d1-440a-8e76-f41645778bd6_832x346.png 1272w, https://substackcdn.com/image/fetch/$s_!JBeF!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b86f2b4-30d1-440a-8e76-f41645778bd6_832x346.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!JBeF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b86f2b4-30d1-440a-8e76-f41645778bd6_832x346.png" width="832" height="346" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9b86f2b4-30d1-440a-8e76-f41645778bd6_832x346.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:346,&quot;width&quot;:832,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:110394,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!JBeF!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b86f2b4-30d1-440a-8e76-f41645778bd6_832x346.png 424w, https://substackcdn.com/image/fetch/$s_!JBeF!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b86f2b4-30d1-440a-8e76-f41645778bd6_832x346.png 848w, https://substackcdn.com/image/fetch/$s_!JBeF!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b86f2b4-30d1-440a-8e76-f41645778bd6_832x346.png 1272w, https://substackcdn.com/image/fetch/$s_!JBeF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b86f2b4-30d1-440a-8e76-f41645778bd6_832x346.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Processing a return example:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!_QR-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F432cc871-5479-44cb-8e2d-282a9ba5e38a_840x346.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_QR-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F432cc871-5479-44cb-8e2d-282a9ba5e38a_840x346.png 424w, https://substackcdn.com/image/fetch/$s_!_QR-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F432cc871-5479-44cb-8e2d-282a9ba5e38a_840x346.png 848w, https://substackcdn.com/image/fetch/$s_!_QR-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F432cc871-5479-44cb-8e2d-282a9ba5e38a_840x346.png 1272w, https://substackcdn.com/image/fetch/$s_!_QR-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F432cc871-5479-44cb-8e2d-282a9ba5e38a_840x346.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!_QR-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F432cc871-5479-44cb-8e2d-282a9ba5e38a_840x346.png" width="840" height="346" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/432cc871-5479-44cb-8e2d-282a9ba5e38a_840x346.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:346,&quot;width&quot;:840,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:115678,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!_QR-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F432cc871-5479-44cb-8e2d-282a9ba5e38a_840x346.png 424w, https://substackcdn.com/image/fetch/$s_!_QR-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F432cc871-5479-44cb-8e2d-282a9ba5e38a_840x346.png 848w, https://substackcdn.com/image/fetch/$s_!_QR-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F432cc871-5479-44cb-8e2d-282a9ba5e38a_840x346.png 1272w, https://substackcdn.com/image/fetch/$s_!_QR-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F432cc871-5479-44cb-8e2d-282a9ba5e38a_840x346.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ul><li><p>Helping LLMs reason and plan with chain-of-thought by providing reasoning steps in the prompt</p></li><li><p>LLMs can struggle with mathematics: Provide access to code interpreter to the LLM. Program-aided language (PAL) models.</p></li><li><p></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!TfW_!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0c4af81-4cc2-44b9-adb6-077ce981ba09_863x380.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!TfW_!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0c4af81-4cc2-44b9-adb6-077ce981ba09_863x380.png 424w, https://substackcdn.com/image/fetch/$s_!TfW_!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0c4af81-4cc2-44b9-adb6-077ce981ba09_863x380.png 848w, https://substackcdn.com/image/fetch/$s_!TfW_!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0c4af81-4cc2-44b9-adb6-077ce981ba09_863x380.png 1272w, https://substackcdn.com/image/fetch/$s_!TfW_!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0c4af81-4cc2-44b9-adb6-077ce981ba09_863x380.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!TfW_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0c4af81-4cc2-44b9-adb6-077ce981ba09_863x380.png" width="863" height="380" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e0c4af81-4cc2-44b9-adb6-077ce981ba09_863x380.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:380,&quot;width&quot;:863,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:276974,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!TfW_!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0c4af81-4cc2-44b9-adb6-077ce981ba09_863x380.png 424w, https://substackcdn.com/image/fetch/$s_!TfW_!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0c4af81-4cc2-44b9-adb6-077ce981ba09_863x380.png 848w, https://substackcdn.com/image/fetch/$s_!TfW_!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0c4af81-4cc2-44b9-adb6-077ce981ba09_863x380.png 1272w, https://substackcdn.com/image/fetch/$s_!TfW_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0c4af81-4cc2-44b9-adb6-077ce981ba09_863x380.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!zJlQ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45955da-94cd-4f8e-9e70-8e6dda7a2205_813x351.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!zJlQ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45955da-94cd-4f8e-9e70-8e6dda7a2205_813x351.png 424w, https://substackcdn.com/image/fetch/$s_!zJlQ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45955da-94cd-4f8e-9e70-8e6dda7a2205_813x351.png 848w, https://substackcdn.com/image/fetch/$s_!zJlQ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45955da-94cd-4f8e-9e70-8e6dda7a2205_813x351.png 1272w, https://substackcdn.com/image/fetch/$s_!zJlQ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45955da-94cd-4f8e-9e70-8e6dda7a2205_813x351.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!zJlQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45955da-94cd-4f8e-9e70-8e6dda7a2205_813x351.png" width="813" height="351" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a45955da-94cd-4f8e-9e70-8e6dda7a2205_813x351.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:351,&quot;width&quot;:813,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:116895,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!zJlQ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45955da-94cd-4f8e-9e70-8e6dda7a2205_813x351.png 424w, https://substackcdn.com/image/fetch/$s_!zJlQ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45955da-94cd-4f8e-9e70-8e6dda7a2205_813x351.png 848w, https://substackcdn.com/image/fetch/$s_!zJlQ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45955da-94cd-4f8e-9e70-8e6dda7a2205_813x351.png 1272w, https://substackcdn.com/image/fetch/$s_!zJlQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa45955da-94cd-4f8e-9e70-8e6dda7a2205_813x351.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>ReAct: Combining reasoning and action</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!OAsW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99faf6d8-f8b8-4cfb-9ce4-fd84c0a05c4e_825x367.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!OAsW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99faf6d8-f8b8-4cfb-9ce4-fd84c0a05c4e_825x367.png 424w, https://substackcdn.com/image/fetch/$s_!OAsW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99faf6d8-f8b8-4cfb-9ce4-fd84c0a05c4e_825x367.png 848w, https://substackcdn.com/image/fetch/$s_!OAsW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99faf6d8-f8b8-4cfb-9ce4-fd84c0a05c4e_825x367.png 1272w, https://substackcdn.com/image/fetch/$s_!OAsW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99faf6d8-f8b8-4cfb-9ce4-fd84c0a05c4e_825x367.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!OAsW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99faf6d8-f8b8-4cfb-9ce4-fd84c0a05c4e_825x367.png" width="825" height="367" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/99faf6d8-f8b8-4cfb-9ce4-fd84c0a05c4e_825x367.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:367,&quot;width&quot;:825,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:109601,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!OAsW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99faf6d8-f8b8-4cfb-9ce4-fd84c0a05c4e_825x367.png 424w, https://substackcdn.com/image/fetch/$s_!OAsW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99faf6d8-f8b8-4cfb-9ce4-fd84c0a05c4e_825x367.png 848w, https://substackcdn.com/image/fetch/$s_!OAsW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99faf6d8-f8b8-4cfb-9ce4-fd84c0a05c4e_825x367.png 1272w, https://substackcdn.com/image/fetch/$s_!OAsW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99faf6d8-f8b8-4cfb-9ce4-fd84c0a05c4e_825x367.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!poS2!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F584304af-611c-4289-bd9d-6c81fbab5fba_848x431.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!poS2!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F584304af-611c-4289-bd9d-6c81fbab5fba_848x431.png 424w, https://substackcdn.com/image/fetch/$s_!poS2!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F584304af-611c-4289-bd9d-6c81fbab5fba_848x431.png 848w, https://substackcdn.com/image/fetch/$s_!poS2!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F584304af-611c-4289-bd9d-6c81fbab5fba_848x431.png 1272w, https://substackcdn.com/image/fetch/$s_!poS2!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F584304af-611c-4289-bd9d-6c81fbab5fba_848x431.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!poS2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F584304af-611c-4289-bd9d-6c81fbab5fba_848x431.png" width="848" height="431" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/584304af-611c-4289-bd9d-6c81fbab5fba_848x431.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:431,&quot;width&quot;:848,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:150924,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!poS2!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F584304af-611c-4289-bd9d-6c81fbab5fba_848x431.png 424w, https://substackcdn.com/image/fetch/$s_!poS2!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F584304af-611c-4289-bd9d-6c81fbab5fba_848x431.png 848w, https://substackcdn.com/image/fetch/$s_!poS2!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F584304af-611c-4289-bd9d-6c81fbab5fba_848x431.png 1272w, https://substackcdn.com/image/fetch/$s_!poS2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F584304af-611c-4289-bd9d-6c81fbab5fba_848x431.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p></li></ul><p>LLM application architectures</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!n9EP!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F794ba200-5460-4f08-abc3-b77d6686d67b_790x361.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!n9EP!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F794ba200-5460-4f08-abc3-b77d6686d67b_790x361.png 424w, https://substackcdn.com/image/fetch/$s_!n9EP!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F794ba200-5460-4f08-abc3-b77d6686d67b_790x361.png 848w, https://substackcdn.com/image/fetch/$s_!n9EP!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F794ba200-5460-4f08-abc3-b77d6686d67b_790x361.png 1272w, https://substackcdn.com/image/fetch/$s_!n9EP!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F794ba200-5460-4f08-abc3-b77d6686d67b_790x361.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!n9EP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F794ba200-5460-4f08-abc3-b77d6686d67b_790x361.png" width="790" height="361" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/794ba200-5460-4f08-abc3-b77d6686d67b_790x361.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:361,&quot;width&quot;:790,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:132182,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!n9EP!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F794ba200-5460-4f08-abc3-b77d6686d67b_790x361.png 424w, https://substackcdn.com/image/fetch/$s_!n9EP!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F794ba200-5460-4f08-abc3-b77d6686d67b_790x361.png 848w, https://substackcdn.com/image/fetch/$s_!n9EP!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F794ba200-5460-4f08-abc3-b77d6686d67b_790x361.png 1272w, https://substackcdn.com/image/fetch/$s_!n9EP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F794ba200-5460-4f08-abc3-b77d6686d67b_790x361.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p>]]></content:encoded></item><item><title><![CDATA[Reinforcement Learning from Human Feedback (RLHF)]]></title><description><![CDATA[A large language model may produce content that is toxic, aggressive, or harmful.]]></description><link>https://roadtoai.substack.com/p/reinforcement-learning-from-human</link><guid isPermaLink="false">https://roadtoai.substack.com/p/reinforcement-learning-from-human</guid><dc:creator><![CDATA[AI with Atlantis]]></dc:creator><pubDate>Wed, 02 Oct 2024 20:16:37 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!DRZf!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87fdf1fd-c86e-4914-aa44-e730972df620_1714x710.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>A large language model may produce content that is toxic, aggressive, or harmful. Additionally, it may generate inaccurate information, a phenomenon known as hallucination. A model behaving badly may produce unhelpful, dishonest or harmful completion.</p><p>The three Hs  to ask about  model outputs: HHH - Helpful? Honest? Harmless?</p><p>Fine-tuning with human feedback helps mitigate these issues. Foe example, research indicates that fine-tuning with human feedback for text summarization task produces better responses compared to reference summaries, models with initial fine-tuning (without human feedback), or no fine-tuning at all.</p><p>A widely used method for fine-tuning large language models with human feedback is known as Reinforcement Learning from Human Feedback (RLHF). As the name implies, RLHF leverages reinforcement learning (RL) to fine-tune the large language model using human feedback data, resulting in a model that is more closely aligned with human preferences. RLHF can be used to ensure the model generates outputs that maximize relevance and usefulness to the input prompt. Most importantly, RLHF helps minimize the potential for harm by training the model to include disclaimers acknowledging its limitations and to avoid toxic language or topics.</p><p>Reinforcement learning is a machine learning approach where an agent learns to make goal-oriented decisions by interacting with an environment and taking actions to maximize a cumulative reward.</p><p>In this framework, the agent learns iteratively by taking actions, observing the changes in the environment, and receiving rewards or penalties based on the outcomes. Through repeated iterations, the agent refines its strategy or policy to make more effective decisions and improve its overall performance.</p><h4>Using Tic-Tac-Toe as an example to explain how RL works</h4><p>In reinforcement learning (RL), an agent learns to achieve a goal by interacting with an environment and receiving feedback. Using Tic-Tac-Toe as an example, let&#8217;s break down how RL works:</p><p>1. <strong>Components in RL for Tic-Tac-Toe</strong>:</p><ul><li><p><strong>Agent</strong>: The player (model) that tries to learn an optimal strategy to win the game.</p></li><li><p><strong>Environment</strong>: The Tic-Tac-Toe board, where the agent and an opponent take turns placing Xs and Os.</p></li><li><p><strong>State (St&#8203;)</strong>: The current configuration of the board at time t, such as which cells are filled and by whom.</p></li><li><p><strong>Action (at&#8203;)</strong>: The agent&#8217;s move at time t, such as placing an X in an empty cell.</p></li><li><p><strong>Action Space</strong>: The set of all possible actions the agent can take at a given state (e.g., choosing any of the empty cells).</p></li><li><p><strong>Reward (Rt&#8203;)</strong>: The feedback received after an action. For example:</p><ul><li><p>+1 if the agent wins.</p></li><li><p>-1 if the agent loses.</p></li><li><p>0 for a draw.</p></li></ul></li></ul><p>2. <strong>Objective</strong>:</p><p>The objective is to learn a policy that maximizes the cumulative reward, which means winning the game as frequently as possible.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!DRZf!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87fdf1fd-c86e-4914-aa44-e730972df620_1714x710.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!DRZf!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87fdf1fd-c86e-4914-aa44-e730972df620_1714x710.png 424w, https://substackcdn.com/image/fetch/$s_!DRZf!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87fdf1fd-c86e-4914-aa44-e730972df620_1714x710.png 848w, https://substackcdn.com/image/fetch/$s_!DRZf!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87fdf1fd-c86e-4914-aa44-e730972df620_1714x710.png 1272w, https://substackcdn.com/image/fetch/$s_!DRZf!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87fdf1fd-c86e-4914-aa44-e730972df620_1714x710.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!DRZf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87fdf1fd-c86e-4914-aa44-e730972df620_1714x710.png" width="1456" height="603" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/87fdf1fd-c86e-4914-aa44-e730972df620_1714x710.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:603,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:307365,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!DRZf!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87fdf1fd-c86e-4914-aa44-e730972df620_1714x710.png 424w, https://substackcdn.com/image/fetch/$s_!DRZf!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87fdf1fd-c86e-4914-aa44-e730972df620_1714x710.png 848w, https://substackcdn.com/image/fetch/$s_!DRZf!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87fdf1fd-c86e-4914-aa44-e730972df620_1714x710.png 1272w, https://substackcdn.com/image/fetch/$s_!DRZf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87fdf1fd-c86e-4914-aa44-e730972df620_1714x710.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>3. <strong>How RL Works in Tic-Tac-Toe</strong>:</p><ol><li><p><strong>Initial State</strong>: The game starts with an empty board (S0&#8203;).</p></li><li><p><strong>Taking Actions</strong>: The agent chooses an action at&#8203; (e.g., placing an X in an empty cell) based on its current policy, which determines which actions to take in different states.</p></li><li><p><strong>Environment Response</strong>: The opponent makes a move, changing the state of the board to St+1&#8203;. This step is repeated until the playout/rollout is over.</p></li><li><p><strong>Reward</strong>: The agent receives a reward Rt&#8203; based on the resulting final state:</p><ul><li><p>If the agent wins, it gets a reward of +1.</p></li><li><p>If the agent loses, it gets a reward of -1.</p></li><li><p>If the game is ongoing, the reward is 0.</p></li></ul></li><li><p><strong>Learning</strong>: The agent updates its policy based on the observed reward to improve its decision-making for future states.</p></li><li><p><strong>Iteration</strong>: The agent continues to play multiple games, refining its policy through repeated interaction and feedback.</p></li></ol><p>4. <strong>Learning a Winning Strategy</strong>:</p><p>The agent explores different moves and learns which sequences of actions lead to winning states, updating its strategy to favor moves that maximize the likelihood of winning. Over time, it becomes capable of anticipating the opponent&#8217;s moves and making decisions that maximize its chances of victory.</p><p>Through repeated gameplay and feedback, the agent learns an optimal policy that guides it to win the game more often by selecting actions that lead to favorable states and avoiding moves that result in losing positions.</p><h4>Fine-tuning LLMs using RL</h4><ul><li><p><strong>Objective</strong>: The goal is to generate text that is aligned with human preferences&#8212;text that is coherent, contextually relevant, and free from harmful or undesirable content.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!tXWo!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09ea9f96-2015-40b5-ba52-44f2eaab0b42_1193x491.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!tXWo!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09ea9f96-2015-40b5-ba52-44f2eaab0b42_1193x491.png 424w, https://substackcdn.com/image/fetch/$s_!tXWo!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09ea9f96-2015-40b5-ba52-44f2eaab0b42_1193x491.png 848w, https://substackcdn.com/image/fetch/$s_!tXWo!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09ea9f96-2015-40b5-ba52-44f2eaab0b42_1193x491.png 1272w, https://substackcdn.com/image/fetch/$s_!tXWo!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09ea9f96-2015-40b5-ba52-44f2eaab0b42_1193x491.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!tXWo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09ea9f96-2015-40b5-ba52-44f2eaab0b42_1193x491.png" width="1193" height="491" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/09ea9f96-2015-40b5-ba52-44f2eaab0b42_1193x491.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:491,&quot;width&quot;:1193,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:253725,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!tXWo!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09ea9f96-2015-40b5-ba52-44f2eaab0b42_1193x491.png 424w, https://substackcdn.com/image/fetch/$s_!tXWo!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09ea9f96-2015-40b5-ba52-44f2eaab0b42_1193x491.png 848w, https://substackcdn.com/image/fetch/$s_!tXWo!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09ea9f96-2015-40b5-ba52-44f2eaab0b42_1193x491.png 1272w, https://substackcdn.com/image/fetch/$s_!tXWo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09ea9f96-2015-40b5-ba52-44f2eaab0b42_1193x491.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div></li><li><p><strong>Agent</strong>: The <strong>agent</strong> is the language model itself, fine-tuned to generate desirable text outputs based on a given prompt.</p></li><li><p><strong>Environment</strong>: The <strong>environment</strong> is the context of the conversation or the prompt provided as input. The model&#8217;s output updates the state of the environment by generating text, which is then evaluated based on alignment criteria.</p></li><li><p><strong>State (St&#8203;)</strong>: The <strong>state</strong> is the prompt combined with the text generated so far. Each time the LLM generates new text, the state changes.</p></li><li><p><strong>Action (at&#8203;)</strong>: An <strong>action</strong> is the next word, sentence, or paragraph generated by the model in response to the prompt and context. The action space here is the probability distribution of the next word.</p></li><li><p><strong>Reward (Rt&#8203;)</strong>: The <strong>reward</strong> is provided based on the quality of the generated text. Rewards are usually derived from human feedback or automatic evaluation metrics. For example:</p><ul><li><p>+1 if the generated text is highly relevant, coherent, and aligned with human preferences.</p></li><li><p>-1 if the text is incoherent, misleading, or toxic.</p></li></ul><h3>Learning Process</h3><ol><li><p><strong>Initial State</strong>: The initial state is the input prompt (e.g., a user question or command).</p></li><li><p><strong>Taking Actions</strong>: The agent generates the next word or sentence based on the current context.</p></li><li><p><strong>Evaluating the Action</strong>: The generated text is evaluated using human feedback or pre-defined metrics (e.g., fluency, correctness, and relevance). Human evaluators can score the output, providing feedback on whether it was aligned or not.</p></li><li><p><strong>Learning from the Outcome</strong>: The model updates its parameters through reinforcement learning techniques like Proximal Policy Optimization (PPO), reinforcing generation patterns that lead to high-reward text (aligned and relevant responses).</p></li></ol><p></p><ul><li><p>Note that in the context of language modeling, the sequence of actions and states is called a <strong>rollout</strong>, instead of the term playout that's used in classic reinforcement learning.</p></li><li><p>When using Reinforcement Learning with Human Feedback (RLHF) to align large language models with human preferences, what is the role of human labelers? In RLHF, human labelers score a dataset of completions by the original model based on alignment criteria like helpfulness, harmlessness, and honesty. This dataset is used to train the reward model that scores the model completions during the RLHF process.</p></li></ul><h3>Challenges with determining the reward</h3></li><li><p>There is a wide variation in human preferences &#8594; This makes determining the reward challenging. One of doing this is for a human to evaluate all the completions of the model against some alignment methods such as determining whether the generated text is toxic or not. There reward could be a 0 or 1 and the LLM updates its weights to improve alignment and maximize reward. However, obtaining human feedback can be time consuming and expensive. One way of alleviating this bottleneck is to use an additional model called reward model which will classify the completion and evaluate the degree of alignment with human preferences.</p><h3>Why RL for LLMs?</h3><p>LLMs learn to generate aligned text through feedback:</p><ul><li><p>Human feedback indicates which text outputs are preferred.</p></li><li><p>The model adjusts its policy to generate outputs that maximize the probability of receiving a positive reward.</p></li><li><p>Over many iterations, the LLM learns to produce text that maximizes human preferences and minimizes undesirable outputs, similar to how an agent learns to optimize its performance in a given environment.</p></li></ul></li></ul><h2>RLHF: Obtaining feedback from humans</h2><ol><li><p>Prompt dataset: consists of prompt samples &#8594; Instructor LLM &#8594; Set of completions</p></li><li><p>Collect human feedback:</p><ol><li><p>&#8216;Define your model alignment criterion</p></li><li><p>For the prompt-response sets that you just generated, obtain human feedback through labeler workforce. Usually assign a sample to multiple labelers (3) to establish consensus and minimize effects from poor labelers.</p></li></ol></li><li><p>Prepare labeled data for training</p><ol><li><p>Convert ranking into pairwise training data for the reward model. (y_j, y_k). If you have three ranked completions, you can have 3 pairs ( combinations). y_j is always the preferred completion.</p></li><li><p>Train the reward model</p><p>Given (prompt x, completion yj) and prompt x, completion yk) minimize the log sigmoid of the difference between the rewards.</p></li><li><p>Use the reward model as a binary classifier to provide a reward value for each prompt-completion pair, in this case the reward value will be a logit.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!X8id!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F540a2c77-cb4e-4aaa-9a34-d6fcdbf6a7ea_962x391.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!X8id!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F540a2c77-cb4e-4aaa-9a34-d6fcdbf6a7ea_962x391.png 424w, https://substackcdn.com/image/fetch/$s_!X8id!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F540a2c77-cb4e-4aaa-9a34-d6fcdbf6a7ea_962x391.png 848w, https://substackcdn.com/image/fetch/$s_!X8id!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F540a2c77-cb4e-4aaa-9a34-d6fcdbf6a7ea_962x391.png 1272w, https://substackcdn.com/image/fetch/$s_!X8id!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F540a2c77-cb4e-4aaa-9a34-d6fcdbf6a7ea_962x391.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!X8id!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F540a2c77-cb4e-4aaa-9a34-d6fcdbf6a7ea_962x391.png" width="962" height="391" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/540a2c77-cb4e-4aaa-9a34-d6fcdbf6a7ea_962x391.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:391,&quot;width&quot;:962,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:149229,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!X8id!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F540a2c77-cb4e-4aaa-9a34-d6fcdbf6a7ea_962x391.png 424w, https://substackcdn.com/image/fetch/$s_!X8id!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F540a2c77-cb4e-4aaa-9a34-d6fcdbf6a7ea_962x391.png 848w, https://substackcdn.com/image/fetch/$s_!X8id!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F540a2c77-cb4e-4aaa-9a34-d6fcdbf6a7ea_962x391.png 1272w, https://substackcdn.com/image/fetch/$s_!X8id!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F540a2c77-cb4e-4aaa-9a34-d6fcdbf6a7ea_962x391.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!wTNY!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2955b324-ecb4-4361-8a88-7479518ef5cc_1254x531.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!wTNY!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2955b324-ecb4-4361-8a88-7479518ef5cc_1254x531.png 424w, https://substackcdn.com/image/fetch/$s_!wTNY!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2955b324-ecb4-4361-8a88-7479518ef5cc_1254x531.png 848w, https://substackcdn.com/image/fetch/$s_!wTNY!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2955b324-ecb4-4361-8a88-7479518ef5cc_1254x531.png 1272w, https://substackcdn.com/image/fetch/$s_!wTNY!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2955b324-ecb4-4361-8a88-7479518ef5cc_1254x531.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!wTNY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2955b324-ecb4-4361-8a88-7479518ef5cc_1254x531.png" width="1254" height="531" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2955b324-ecb4-4361-8a88-7479518ef5cc_1254x531.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:531,&quot;width&quot;:1254,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:314097,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!wTNY!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2955b324-ecb4-4361-8a88-7479518ef5cc_1254x531.png 424w, https://substackcdn.com/image/fetch/$s_!wTNY!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2955b324-ecb4-4361-8a88-7479518ef5cc_1254x531.png 848w, https://substackcdn.com/image/fetch/$s_!wTNY!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2955b324-ecb4-4361-8a88-7479518ef5cc_1254x531.png 1272w, https://substackcdn.com/image/fetch/$s_!wTNY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2955b324-ecb4-4361-8a88-7479518ef5cc_1254x531.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3><strong>RLHF: Fine-tuning with reinforcement learning</strong></h3></li></ol></li></ol><p>For each iteration, for a given prompt the LLM generates a completion. The reward model generates a reward value for the completion&#8217;s degree of human alignment. The RL algorithm then updates the LLM weights based on the reward value. This will continue until the LLM is updated to a human-aligned LLM or after pre-defined number of iterations. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!BSu0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d9c1175-c84f-46c7-b508-b011a6c3a1c0_1039x504.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!BSu0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d9c1175-c84f-46c7-b508-b011a6c3a1c0_1039x504.png 424w, https://substackcdn.com/image/fetch/$s_!BSu0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d9c1175-c84f-46c7-b508-b011a6c3a1c0_1039x504.png 848w, https://substackcdn.com/image/fetch/$s_!BSu0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d9c1175-c84f-46c7-b508-b011a6c3a1c0_1039x504.png 1272w, https://substackcdn.com/image/fetch/$s_!BSu0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d9c1175-c84f-46c7-b508-b011a6c3a1c0_1039x504.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!BSu0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d9c1175-c84f-46c7-b508-b011a6c3a1c0_1039x504.png" width="1039" height="504" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0d9c1175-c84f-46c7-b508-b011a6c3a1c0_1039x504.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:504,&quot;width&quot;:1039,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:164437,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!BSu0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d9c1175-c84f-46c7-b508-b011a6c3a1c0_1039x504.png 424w, https://substackcdn.com/image/fetch/$s_!BSu0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d9c1175-c84f-46c7-b508-b011a6c3a1c0_1039x504.png 848w, https://substackcdn.com/image/fetch/$s_!BSu0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d9c1175-c84f-46c7-b508-b011a6c3a1c0_1039x504.png 1272w, https://substackcdn.com/image/fetch/$s_!BSu0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d9c1175-c84f-46c7-b508-b011a6c3a1c0_1039x504.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>RL algorithm: Proximal Policy Optimization (PPO)</h3><p>PPO updated the Policy - in this case the LLM to be more aligned with human preferences. The updated are small and within a bounded region.</p><p>PPO Phase 1: </p><ul><li><p>Create completions to a number of prompts. These are experiments to assess the outcome of the current model, e.g. how helpful, harmless, hones the model is.</p></li><li><p>Calculate the reward for each prompt, completion pair using the reward model.</p></li><li><p>The Value function estimates future total reward a given generated next token.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!9qu2!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8a58803f-e18b-42ee-9275-5581c9562a8e_756x481.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!9qu2!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8a58803f-e18b-42ee-9275-5581c9562a8e_756x481.png 424w, https://substackcdn.com/image/fetch/$s_!9qu2!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8a58803f-e18b-42ee-9275-5581c9562a8e_756x481.png 848w, https://substackcdn.com/image/fetch/$s_!9qu2!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8a58803f-e18b-42ee-9275-5581c9562a8e_756x481.png 1272w, https://substackcdn.com/image/fetch/$s_!9qu2!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8a58803f-e18b-42ee-9275-5581c9562a8e_756x481.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!9qu2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8a58803f-e18b-42ee-9275-5581c9562a8e_756x481.png" width="756" height="481" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8a58803f-e18b-42ee-9275-5581c9562a8e_756x481.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:481,&quot;width&quot;:756,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:133386,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!9qu2!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8a58803f-e18b-42ee-9275-5581c9562a8e_756x481.png 424w, https://substackcdn.com/image/fetch/$s_!9qu2!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8a58803f-e18b-42ee-9275-5581c9562a8e_756x481.png 848w, https://substackcdn.com/image/fetch/$s_!9qu2!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8a58803f-e18b-42ee-9275-5581c9562a8e_756x481.png 1272w, https://substackcdn.com/image/fetch/$s_!9qu2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8a58803f-e18b-42ee-9275-5581c9562a8e_756x481.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The goal is to minimize the difference between the its approximation to the value function (1.23) and the actual future total reward (1.87)</p></li></ul><p>PPO phase 2: Calculate the policy loss</p><p>The PPO algorithm uses a <strong>surrogate objective</strong> function that is modified by a clipping mechanism. This clipping serves to restrict the size of policy updates to a safe range, which stabilizes training and prevents large updates that could negatively impact performance.</p><p>In PPO, the objective function is typically represented as:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!vQ1Z!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58c3a871-519a-466e-91ef-768c563c1b0d_728x375.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!vQ1Z!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58c3a871-519a-466e-91ef-768c563c1b0d_728x375.png 424w, https://substackcdn.com/image/fetch/$s_!vQ1Z!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58c3a871-519a-466e-91ef-768c563c1b0d_728x375.png 848w, https://substackcdn.com/image/fetch/$s_!vQ1Z!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58c3a871-519a-466e-91ef-768c563c1b0d_728x375.png 1272w, https://substackcdn.com/image/fetch/$s_!vQ1Z!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58c3a871-519a-466e-91ef-768c563c1b0d_728x375.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!vQ1Z!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58c3a871-519a-466e-91ef-768c563c1b0d_728x375.png" width="728" height="375" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/58c3a871-519a-466e-91ef-768c563c1b0d_728x375.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:375,&quot;width&quot;:728,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:68777,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!vQ1Z!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58c3a871-519a-466e-91ef-768c563c1b0d_728x375.png 424w, https://substackcdn.com/image/fetch/$s_!vQ1Z!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58c3a871-519a-466e-91ef-768c563c1b0d_728x375.png 848w, https://substackcdn.com/image/fetch/$s_!vQ1Z!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58c3a871-519a-466e-91ef-768c563c1b0d_728x375.png 1272w, https://substackcdn.com/image/fetch/$s_!vQ1Z!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F58c3a871-519a-466e-91ef-768c563c1b0d_728x375.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!rWGP!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F73697be3-c688-4fca-b84a-ab894052b622_750x280.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!rWGP!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F73697be3-c688-4fca-b84a-ab894052b622_750x280.png 424w, https://substackcdn.com/image/fetch/$s_!rWGP!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F73697be3-c688-4fca-b84a-ab894052b622_750x280.png 848w, https://substackcdn.com/image/fetch/$s_!rWGP!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F73697be3-c688-4fca-b84a-ab894052b622_750x280.png 1272w, https://substackcdn.com/image/fetch/$s_!rWGP!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F73697be3-c688-4fca-b84a-ab894052b622_750x280.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!rWGP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F73697be3-c688-4fca-b84a-ab894052b622_750x280.png" width="750" height="280" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/73697be3-c688-4fca-b84a-ab894052b622_750x280.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:280,&quot;width&quot;:750,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:43553,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!rWGP!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F73697be3-c688-4fca-b84a-ab894052b622_750x280.png 424w, https://substackcdn.com/image/fetch/$s_!rWGP!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F73697be3-c688-4fca-b84a-ab894052b622_750x280.png 848w, https://substackcdn.com/image/fetch/$s_!rWGP!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F73697be3-c688-4fca-b84a-ab894052b622_750x280.png 1272w, https://substackcdn.com/image/fetch/$s_!rWGP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F73697be3-c688-4fca-b84a-ab894052b622_750x280.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Purpose of Clipping</p><p>The clipping serves the following purposes:</p><ol><li><p><strong>Prevent Large Policy Updates</strong>: Clipping limits the change in the probability ratio rt&#8203;(&#952;). This prevents the new policy from making large updates to the action probabilities, which can destabilize learning.</p></li><li><p><strong>Reduce Variance</strong>: By controlling the policy change, clipping reduces the variance in updates, leading to more stable learning.</p></li><li><p><strong>Ensure Monotonic Improvement</strong>: By avoiding large policy changes, clipping helps ensure that each policy update improves performance incrementally, avoiding sudden performance drops.</p></li></ol><p>How it Works in Practice</p><ul><li><p>If the policy change results in rt&#8203;(&#952;) being too far from 1 (indicating a large policy shift), the clipped version of the ratio is used instead, which restricts the impact of the policy update.</p></li><li><p>The objective function L_CLIP(&#952;) takes the minimum of the original objective and the clipped objective. This ensures that updates only occur if they improve the objective within a safe range, effectively discouraging large deviations from the current policy.</p></li></ul><p>PPO Phase 2: Calculate the entropy loss</p><ul><li><p>Entropy allows the model to maintain creativity. Higher entropy means LLM is more creative. This is like the Temperate during inference. Entropy loss how every is during training.</p></li><li><p>PPO Phase: Total objective function. C1 and C2 are HPs. For each PPO cycle the LLM is updated to a new LLM.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!S8tK!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b4805ba-b7c1-4dc4-8c22-9fbeac567570_506x146.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!S8tK!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b4805ba-b7c1-4dc4-8c22-9fbeac567570_506x146.png 424w, https://substackcdn.com/image/fetch/$s_!S8tK!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b4805ba-b7c1-4dc4-8c22-9fbeac567570_506x146.png 848w, https://substackcdn.com/image/fetch/$s_!S8tK!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b4805ba-b7c1-4dc4-8c22-9fbeac567570_506x146.png 1272w, https://substackcdn.com/image/fetch/$s_!S8tK!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b4805ba-b7c1-4dc4-8c22-9fbeac567570_506x146.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!S8tK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b4805ba-b7c1-4dc4-8c22-9fbeac567570_506x146.png" width="506" height="146" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2b4805ba-b7c1-4dc4-8c22-9fbeac567570_506x146.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:146,&quot;width&quot;:506,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:30715,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!S8tK!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b4805ba-b7c1-4dc4-8c22-9fbeac567570_506x146.png 424w, https://substackcdn.com/image/fetch/$s_!S8tK!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b4805ba-b7c1-4dc4-8c22-9fbeac567570_506x146.png 848w, https://substackcdn.com/image/fetch/$s_!S8tK!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b4805ba-b7c1-4dc4-8c22-9fbeac567570_506x146.png 1272w, https://substackcdn.com/image/fetch/$s_!S8tK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b4805ba-b7c1-4dc4-8c22-9fbeac567570_506x146.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><ul><li><p>Q-learning is an alternate technique for fine-tuning LLMs through RL.</p></li><li><p>DPO (Direct Preference Optimization) by Stanford is a simpler alternate to RLHF.</p></li></ul></li></ul><p>RLHF: Reward hacking</p><ul><li><p>The agent learns to cheat the system by favoring actions that maximize the reward received even if those actions don&#8217;t align well with the original objective. In such scenarios we can use the original LLM as performance reference by computing KL divergence between the reference and the intermediate LLM probability distributions.</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!PWas!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f33fe1b-d683-4b9a-93e1-d51eae857444_1303x621.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!PWas!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f33fe1b-d683-4b9a-93e1-d51eae857444_1303x621.png 424w, https://substackcdn.com/image/fetch/$s_!PWas!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f33fe1b-d683-4b9a-93e1-d51eae857444_1303x621.png 848w, https://substackcdn.com/image/fetch/$s_!PWas!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f33fe1b-d683-4b9a-93e1-d51eae857444_1303x621.png 1272w, https://substackcdn.com/image/fetch/$s_!PWas!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f33fe1b-d683-4b9a-93e1-d51eae857444_1303x621.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!PWas!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f33fe1b-d683-4b9a-93e1-d51eae857444_1303x621.png" width="1303" height="621" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6f33fe1b-d683-4b9a-93e1-d51eae857444_1303x621.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:621,&quot;width&quot;:1303,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:388250,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!PWas!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f33fe1b-d683-4b9a-93e1-d51eae857444_1303x621.png 424w, https://substackcdn.com/image/fetch/$s_!PWas!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f33fe1b-d683-4b9a-93e1-d51eae857444_1303x621.png 848w, https://substackcdn.com/image/fetch/$s_!PWas!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f33fe1b-d683-4b9a-93e1-d51eae857444_1303x621.png 1272w, https://substackcdn.com/image/fetch/$s_!PWas!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f33fe1b-d683-4b9a-93e1-d51eae857444_1303x621.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>Scaling Human Feedback</h3><ul><li><p>Building a reward model requires 10&#8217;s of thousands of human reference labels. </p></li><li><p>Solution: Model Self-supervision &#8594; Constitutional AI. Model is trained using guiding rules/principles. Along with proper prompting forms the constitution.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Ru4k!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcb9a49f7-a10b-444f-a294-b08882cb6504_1167x571.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Ru4k!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcb9a49f7-a10b-444f-a294-b08882cb6504_1167x571.png 424w, https://substackcdn.com/image/fetch/$s_!Ru4k!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcb9a49f7-a10b-444f-a294-b08882cb6504_1167x571.png 848w, https://substackcdn.com/image/fetch/$s_!Ru4k!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcb9a49f7-a10b-444f-a294-b08882cb6504_1167x571.png 1272w, https://substackcdn.com/image/fetch/$s_!Ru4k!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcb9a49f7-a10b-444f-a294-b08882cb6504_1167x571.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Ru4k!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcb9a49f7-a10b-444f-a294-b08882cb6504_1167x571.png" width="1167" height="571" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/cb9a49f7-a10b-444f-a294-b08882cb6504_1167x571.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:571,&quot;width&quot;:1167,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:571609,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Ru4k!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcb9a49f7-a10b-444f-a294-b08882cb6504_1167x571.png 424w, https://substackcdn.com/image/fetch/$s_!Ru4k!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcb9a49f7-a10b-444f-a294-b08882cb6504_1167x571.png 848w, https://substackcdn.com/image/fetch/$s_!Ru4k!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcb9a49f7-a10b-444f-a294-b08882cb6504_1167x571.png 1272w, https://substackcdn.com/image/fetch/$s_!Ru4k!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcb9a49f7-a10b-444f-a294-b08882cb6504_1167x571.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ul><li><p>Prompt the model in ways that try to get it to generate harmful responses, this process is called red teaming.</p></li><li><p>You then ask the model to critique its own harmful responses according to</p></li></ul><p>the constitutional principles and revise them to comply with those rules.</p><ul><li><p>Once done, you'll fine-tune the model using the pairs of red team prompts and the revised constitutional responses.</p></li></ul></li></ul><h3>References:</h3><ol><li><p>https://www.coursera.org/learn/generative-ai-with-llms/</p></li><li><p>https://huggingface.co/blog/trl-peft</p></li></ol>]]></content:encoded></item><item><title><![CDATA[Deep learning fundamentals]]></title><description><![CDATA[My notes from: Intel Nervana AI academy, introduction to neural networks.]]></description><link>https://roadtoai.substack.com/p/deep-learning-fundamentals</link><guid isPermaLink="false">https://roadtoai.substack.com/p/deep-learning-fundamentals</guid><dc:creator><![CDATA[AI with Atlantis]]></dc:creator><pubDate>Thu, 26 Sep 2024 17:54:57 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!0kCG!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5392775-4828-4034-ab0f-562dd1bf60b1_1322x450.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Neural nets use biology as an inspiration for mathematical model. A neuron gets signals from previous neurons and may generate signals according to inputs. Then it passes generated signals to the next neurons. By layering many such neurons, neural nets can be used to create a complex model.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!0kCG!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5392775-4828-4034-ab0f-562dd1bf60b1_1322x450.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!0kCG!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5392775-4828-4034-ab0f-562dd1bf60b1_1322x450.png 424w, https://substackcdn.com/image/fetch/$s_!0kCG!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5392775-4828-4034-ab0f-562dd1bf60b1_1322x450.png 848w, https://substackcdn.com/image/fetch/$s_!0kCG!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5392775-4828-4034-ab0f-562dd1bf60b1_1322x450.png 1272w, https://substackcdn.com/image/fetch/$s_!0kCG!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5392775-4828-4034-ab0f-562dd1bf60b1_1322x450.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!0kCG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5392775-4828-4034-ab0f-562dd1bf60b1_1322x450.png" width="1322" height="450" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d5392775-4828-4034-ab0f-562dd1bf60b1_1322x450.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:450,&quot;width&quot;:1322,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:319347,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!0kCG!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5392775-4828-4034-ab0f-562dd1bf60b1_1322x450.png 424w, https://substackcdn.com/image/fetch/$s_!0kCG!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5392775-4828-4034-ab0f-562dd1bf60b1_1322x450.png 848w, https://substackcdn.com/image/fetch/$s_!0kCG!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5392775-4828-4034-ab0f-562dd1bf60b1_1322x450.png 1272w, https://substackcdn.com/image/fetch/$s_!0kCG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5392775-4828-4034-ab0f-562dd1bf60b1_1322x450.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>A basic neuron get data from a previous layer, applies some form of computation to transform the inputs and outputs the transformed data.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!KbLv!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6bcf0076-f545-4348-8e18-7ac2cc6e4200_1592x844.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!KbLv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6bcf0076-f545-4348-8e18-7ac2cc6e4200_1592x844.png 424w, https://substackcdn.com/image/fetch/$s_!KbLv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6bcf0076-f545-4348-8e18-7ac2cc6e4200_1592x844.png 848w, https://substackcdn.com/image/fetch/$s_!KbLv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6bcf0076-f545-4348-8e18-7ac2cc6e4200_1592x844.png 1272w, https://substackcdn.com/image/fetch/$s_!KbLv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6bcf0076-f545-4348-8e18-7ac2cc6e4200_1592x844.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!KbLv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6bcf0076-f545-4348-8e18-7ac2cc6e4200_1592x844.png" width="1456" height="772" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6bcf0076-f545-4348-8e18-7ac2cc6e4200_1592x844.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:772,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:379054,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!KbLv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6bcf0076-f545-4348-8e18-7ac2cc6e4200_1592x844.png 424w, https://substackcdn.com/image/fetch/$s_!KbLv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6bcf0076-f545-4348-8e18-7ac2cc6e4200_1592x844.png 848w, https://substackcdn.com/image/fetch/$s_!KbLv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6bcf0076-f545-4348-8e18-7ac2cc6e4200_1592x844.png 1272w, https://substackcdn.com/image/fetch/$s_!KbLv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6bcf0076-f545-4348-8e18-7ac2cc6e4200_1592x844.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!N_MZ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad09ea1f-c1e8-43df-828f-515ad1799213_1482x480.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!N_MZ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad09ea1f-c1e8-43df-828f-515ad1799213_1482x480.png 424w, https://substackcdn.com/image/fetch/$s_!N_MZ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad09ea1f-c1e8-43df-828f-515ad1799213_1482x480.png 848w, https://substackcdn.com/image/fetch/$s_!N_MZ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad09ea1f-c1e8-43df-828f-515ad1799213_1482x480.png 1272w, https://substackcdn.com/image/fetch/$s_!N_MZ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad09ea1f-c1e8-43df-828f-515ad1799213_1482x480.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!N_MZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad09ea1f-c1e8-43df-828f-515ad1799213_1482x480.png" width="1456" height="472" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ad09ea1f-c1e8-43df-828f-515ad1799213_1482x480.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:472,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:240143,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!N_MZ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad09ea1f-c1e8-43df-828f-515ad1799213_1482x480.png 424w, https://substackcdn.com/image/fetch/$s_!N_MZ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad09ea1f-c1e8-43df-828f-515ad1799213_1482x480.png 848w, https://substackcdn.com/image/fetch/$s_!N_MZ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad09ea1f-c1e8-43df-828f-515ad1799213_1482x480.png 1272w, https://substackcdn.com/image/fetch/$s_!N_MZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad09ea1f-c1e8-43df-828f-515ad1799213_1482x480.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>When the activation function is  a sigmoid function, a neuron is simply a &#8220;unit&#8221; of logistic regression. Weight &lt;=&gt; coefficients, input &lt;=&gt; variables , bias term &lt;=&gt; constant term.</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\sigma = \\frac{1}{1+e^{-z}}&quot;,&quot;id&quot;:&quot;PZDHPZOKIJ&quot;}" data-component-name="LatexBlockToDOM"></div><p>Derivative of a sigmoid function.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!fHP8!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3391d737-0906-4ec1-862c-2d7c0f4ad0f6_1932x846.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!fHP8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3391d737-0906-4ec1-862c-2d7c0f4ad0f6_1932x846.png 424w, https://substackcdn.com/image/fetch/$s_!fHP8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3391d737-0906-4ec1-862c-2d7c0f4ad0f6_1932x846.png 848w, https://substackcdn.com/image/fetch/$s_!fHP8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3391d737-0906-4ec1-862c-2d7c0f4ad0f6_1932x846.png 1272w, https://substackcdn.com/image/fetch/$s_!fHP8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3391d737-0906-4ec1-862c-2d7c0f4ad0f6_1932x846.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!fHP8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3391d737-0906-4ec1-862c-2d7c0f4ad0f6_1932x846.png" width="1456" height="638" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3391d737-0906-4ec1-862c-2d7c0f4ad0f6_1932x846.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:638,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:514795,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!fHP8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3391d737-0906-4ec1-862c-2d7c0f4ad0f6_1932x846.png 424w, https://substackcdn.com/image/fetch/$s_!fHP8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3391d737-0906-4ec1-862c-2d7c0f4ad0f6_1932x846.png 848w, https://substackcdn.com/image/fetch/$s_!fHP8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3391d737-0906-4ec1-862c-2d7c0f4ad0f6_1932x846.png 1272w, https://substackcdn.com/image/fetch/$s_!fHP8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3391d737-0906-4ec1-862c-2d7c0f4ad0f6_1932x846.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ul><li><p>We need a larger network because a single neuron like logistic regression only permits a linear decision boundary.</p></li><li><p>The net input to the first hidden layer is sum of weighted inputs before activation function.</p></li><li><p>Activations are output of neurons to the next layer</p></li></ul><p><strong>Matrix representation</strong></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Ck-0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F481bc6b0-31cf-40cb-9923-781c55655696_1832x884.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Ck-0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F481bc6b0-31cf-40cb-9923-781c55655696_1832x884.png 424w, https://substackcdn.com/image/fetch/$s_!Ck-0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F481bc6b0-31cf-40cb-9923-781c55655696_1832x884.png 848w, https://substackcdn.com/image/fetch/$s_!Ck-0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F481bc6b0-31cf-40cb-9923-781c55655696_1832x884.png 1272w, https://substackcdn.com/image/fetch/$s_!Ck-0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F481bc6b0-31cf-40cb-9923-781c55655696_1832x884.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Ck-0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F481bc6b0-31cf-40cb-9923-781c55655696_1832x884.png" width="1456" height="703" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/481bc6b0-31cf-40cb-9923-781c55655696_1832x884.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:703,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:606845,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Ck-0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F481bc6b0-31cf-40cb-9923-781c55655696_1832x884.png 424w, https://substackcdn.com/image/fetch/$s_!Ck-0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F481bc6b0-31cf-40cb-9923-781c55655696_1832x884.png 848w, https://substackcdn.com/image/fetch/$s_!Ck-0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F481bc6b0-31cf-40cb-9923-781c55655696_1832x884.png 1272w, https://substackcdn.com/image/fetch/$s_!Ck-0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F481bc6b0-31cf-40cb-9923-781c55655696_1832x884.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Cq_P!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6061211b-104a-4cf1-bb9f-b306a7133d3f_2020x1080.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Cq_P!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6061211b-104a-4cf1-bb9f-b306a7133d3f_2020x1080.png 424w, https://substackcdn.com/image/fetch/$s_!Cq_P!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6061211b-104a-4cf1-bb9f-b306a7133d3f_2020x1080.png 848w, https://substackcdn.com/image/fetch/$s_!Cq_P!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6061211b-104a-4cf1-bb9f-b306a7133d3f_2020x1080.png 1272w, https://substackcdn.com/image/fetch/$s_!Cq_P!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6061211b-104a-4cf1-bb9f-b306a7133d3f_2020x1080.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Cq_P!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6061211b-104a-4cf1-bb9f-b306a7133d3f_2020x1080.png" width="1456" height="778" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6061211b-104a-4cf1-bb9f-b306a7133d3f_2020x1080.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:778,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:931115,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Cq_P!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6061211b-104a-4cf1-bb9f-b306a7133d3f_2020x1080.png 424w, https://substackcdn.com/image/fetch/$s_!Cq_P!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6061211b-104a-4cf1-bb9f-b306a7133d3f_2020x1080.png 848w, https://substackcdn.com/image/fetch/$s_!Cq_P!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6061211b-104a-4cf1-bb9f-b306a7133d3f_2020x1080.png 1272w, https://substackcdn.com/image/fetch/$s_!Cq_P!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6061211b-104a-4cf1-bb9f-b306a7133d3f_2020x1080.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Gradients at each layer to use for backpropagation.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!VrKj!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F473dc3d6-98f9-46c7-b14a-de608e38d204_1488x800.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!VrKj!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F473dc3d6-98f9-46c7-b14a-de608e38d204_1488x800.png 424w, https://substackcdn.com/image/fetch/$s_!VrKj!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F473dc3d6-98f9-46c7-b14a-de608e38d204_1488x800.png 848w, https://substackcdn.com/image/fetch/$s_!VrKj!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F473dc3d6-98f9-46c7-b14a-de608e38d204_1488x800.png 1272w, https://substackcdn.com/image/fetch/$s_!VrKj!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F473dc3d6-98f9-46c7-b14a-de608e38d204_1488x800.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!VrKj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F473dc3d6-98f9-46c7-b14a-de608e38d204_1488x800.png" width="1456" height="783" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/473dc3d6-98f9-46c7-b14a-de608e38d204_1488x800.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:783,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:380345,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!VrKj!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F473dc3d6-98f9-46c7-b14a-de608e38d204_1488x800.png 424w, https://substackcdn.com/image/fetch/$s_!VrKj!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F473dc3d6-98f9-46c7-b14a-de608e38d204_1488x800.png 848w, https://substackcdn.com/image/fetch/$s_!VrKj!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F473dc3d6-98f9-46c7-b14a-de608e38d204_1488x800.png 1272w, https://substackcdn.com/image/fetch/$s_!VrKj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F473dc3d6-98f9-46c7-b14a-de608e38d204_1488x800.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Vanishing gradients:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\sigma^{'}(z) = \\sigma(z)(1-\\sigma(z)) \\leq 0.25&quot;,&quot;id&quot;:&quot;CYVGKNDSND&quot;}" data-component-name="LatexBlockToDOM"></div><p>From the above gradient equation, we can see that as we have more layers, the gradient gets very small at the early layers. This is known as the &#8220;vanishing gradient&#8221; problem. </p><p>Other activation functions to the rescue:</p><ul><li><p>Hyperbolic tangent function ( tanh)</p></li></ul><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;tanh(z) = \\frac{sinh(z)}{cosh(z)} = \\frac{e^{2x} - 1}{e^{2x} + 1}&quot;,&quot;id&quot;:&quot;INKYMIXCQT&quot;}" data-component-name="LatexBlockToDOM"></div><ul><li><p>Rectified Linear Unit (RELU)</p></li></ul><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\nReLU(z) = \\begin{cases}\n 0, z < 0, \n\\\\ z, z \\geq 0)\n\\end{cases}\n&quot;,&quot;id&quot;:&quot;YCLGGTGKIH&quot;}" data-component-name="LatexBlockToDOM"></div><ul><li><p>&#8220;Leaky&#8221; ReLU</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\nLReLU(z) = \\begin{cases}\n\\alpha Z, Z < 0 \\\\\nZ, Z \\geq 0\n\\end{cases}\n&quot;,&quot;id&quot;:&quot;MROXXSYWCT&quot;}" data-component-name="LatexBlockToDOM"></div></li></ul><p>How often do we need to updated the weights using gradient descent?</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!al1S!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35697335-5662-4924-b9f1-d0e27d9d1377_744x817.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!al1S!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35697335-5662-4924-b9f1-d0e27d9d1377_744x817.png 424w, https://substackcdn.com/image/fetch/$s_!al1S!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35697335-5662-4924-b9f1-d0e27d9d1377_744x817.png 848w, https://substackcdn.com/image/fetch/$s_!al1S!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35697335-5662-4924-b9f1-d0e27d9d1377_744x817.png 1272w, https://substackcdn.com/image/fetch/$s_!al1S!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35697335-5662-4924-b9f1-d0e27d9d1377_744x817.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!al1S!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35697335-5662-4924-b9f1-d0e27d9d1377_744x817.png" width="744" height="817" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/35697335-5662-4924-b9f1-d0e27d9d1377_744x817.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:817,&quot;width&quot;:744,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:156023,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!al1S!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35697335-5662-4924-b9f1-d0e27d9d1377_744x817.png 424w, https://substackcdn.com/image/fetch/$s_!al1S!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35697335-5662-4924-b9f1-d0e27d9d1377_744x817.png 848w, https://substackcdn.com/image/fetch/$s_!al1S!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35697335-5662-4924-b9f1-d0e27d9d1377_744x817.png 1272w, https://substackcdn.com/image/fetch/$s_!al1S!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F35697335-5662-4924-b9f1-d0e27d9d1377_744x817.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div>]]></content:encoded></item><item><title><![CDATA[Gen AI project life cycle: Model selection]]></title><description><![CDATA[Course notes from Gen AI with LLMs - Coursera/AWS]]></description><link>https://roadtoai.substack.com/p/gen-ai-project-life-cycle-model-selection</link><guid isPermaLink="false">https://roadtoai.substack.com/p/gen-ai-project-life-cycle-model-selection</guid><dc:creator><![CDATA[AI with Atlantis]]></dc:creator><pubDate>Thu, 26 Sep 2024 17:54:08 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!_sW9!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67477aff-0845-46df-aba9-abbf7954ae14_1269x557.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Considerations for choosing a model</p><ul><li><p>Foundation model  - Pre-trained LLM</p><ul><li><p>Pre-training: GB &#8594; TB &#8594; PB side data, use of GPUs, data quality filter.</p></li><li><p>Model architecture: encoder only, encoder decoder, decoder only models.</p></li><li><p>Encoder only models: Masked Language Modeling(MLM), objective: denoising: predict the masked token, bidirectional. Use cases: sentiment analysis, named entity recognition, word classification. Examples: BERT, ROBERTA</p></li><li><p>Decoder only models: Autoregressive models, objective: Predict next token, Causal Language modeling, unidirectional context. Use cases: Text generation, other emergent behavior dependent on model size, examples: GPT, Bloom</p></li><li><p>Encoder Decoder ( sequence-to-sequence) models: objective: vary from model to model. Example objectives ( in T5 , BART model)s: Span corruption, mask a reange of contiguous words. A sentinel token is a special palceholder used to represent and mark the beginning of a missing or masked span in the input sequence. Objective: Reconstruct the span. Good use cases: Translation, text summarization, question answering. Example models: T5, BART</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!_sW9!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67477aff-0845-46df-aba9-abbf7954ae14_1269x557.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_sW9!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67477aff-0845-46df-aba9-abbf7954ae14_1269x557.png 424w, https://substackcdn.com/image/fetch/$s_!_sW9!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67477aff-0845-46df-aba9-abbf7954ae14_1269x557.png 848w, https://substackcdn.com/image/fetch/$s_!_sW9!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67477aff-0845-46df-aba9-abbf7954ae14_1269x557.png 1272w, https://substackcdn.com/image/fetch/$s_!_sW9!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67477aff-0845-46df-aba9-abbf7954ae14_1269x557.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!_sW9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67477aff-0845-46df-aba9-abbf7954ae14_1269x557.png" width="1269" height="557" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/67477aff-0845-46df-aba9-abbf7954ae14_1269x557.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:557,&quot;width&quot;:1269,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:210785,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!_sW9!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67477aff-0845-46df-aba9-abbf7954ae14_1269x557.png 424w, https://substackcdn.com/image/fetch/$s_!_sW9!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67477aff-0845-46df-aba9-abbf7954ae14_1269x557.png 848w, https://substackcdn.com/image/fetch/$s_!_sW9!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67477aff-0845-46df-aba9-abbf7954ae14_1269x557.png 1272w, https://substackcdn.com/image/fetch/$s_!_sW9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67477aff-0845-46df-aba9-abbf7954ae14_1269x557.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div></li></ul></li><li><p>Summary</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!5lL8!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5dc04796-a3ab-4f4f-bbfd-360bb0d64535_1310x636.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5lL8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5dc04796-a3ab-4f4f-bbfd-360bb0d64535_1310x636.png 424w, https://substackcdn.com/image/fetch/$s_!5lL8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5dc04796-a3ab-4f4f-bbfd-360bb0d64535_1310x636.png 848w, https://substackcdn.com/image/fetch/$s_!5lL8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5dc04796-a3ab-4f4f-bbfd-360bb0d64535_1310x636.png 1272w, https://substackcdn.com/image/fetch/$s_!5lL8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5dc04796-a3ab-4f4f-bbfd-360bb0d64535_1310x636.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!5lL8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5dc04796-a3ab-4f4f-bbfd-360bb0d64535_1310x636.png" width="1310" height="636" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5dc04796-a3ab-4f4f-bbfd-360bb0d64535_1310x636.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:636,&quot;width&quot;:1310,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:367785,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!5lL8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5dc04796-a3ab-4f4f-bbfd-360bb0d64535_1310x636.png 424w, https://substackcdn.com/image/fetch/$s_!5lL8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5dc04796-a3ab-4f4f-bbfd-360bb0d64535_1310x636.png 848w, https://substackcdn.com/image/fetch/$s_!5lL8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5dc04796-a3ab-4f4f-bbfd-360bb0d64535_1310x636.png 1272w, https://substackcdn.com/image/fetch/$s_!5lL8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5dc04796-a3ab-4f4f-bbfd-360bb0d64535_1310x636.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div></li></ul><h3>The Computational Challenges of training LLMs</h3><p>Approximate GPU RAM needed to store 1B parameters.</p><ul><li><p>1 parameter = 4 bytes ( 32-bit float)</p></li><li><p>1 B parameters = 4*10^9 byes = 4 GB</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!DrFV!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd75a22a-824a-425d-b318-dcabf215a20c_1258x509.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!DrFV!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd75a22a-824a-425d-b318-dcabf215a20c_1258x509.png 424w, https://substackcdn.com/image/fetch/$s_!DrFV!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd75a22a-824a-425d-b318-dcabf215a20c_1258x509.png 848w, https://substackcdn.com/image/fetch/$s_!DrFV!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd75a22a-824a-425d-b318-dcabf215a20c_1258x509.png 1272w, https://substackcdn.com/image/fetch/$s_!DrFV!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd75a22a-824a-425d-b318-dcabf215a20c_1258x509.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!DrFV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd75a22a-824a-425d-b318-dcabf215a20c_1258x509.png" width="1258" height="509" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bd75a22a-824a-425d-b318-dcabf215a20c_1258x509.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:509,&quot;width&quot;:1258,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:220297,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!DrFV!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd75a22a-824a-425d-b318-dcabf215a20c_1258x509.png 424w, https://substackcdn.com/image/fetch/$s_!DrFV!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd75a22a-824a-425d-b318-dcabf215a20c_1258x509.png 848w, https://substackcdn.com/image/fetch/$s_!DrFV!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd75a22a-824a-425d-b318-dcabf215a20c_1258x509.png 1272w, https://substackcdn.com/image/fetch/$s_!DrFV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd75a22a-824a-425d-b318-dcabf215a20c_1258x509.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Memory needed to store a model: 4Gb@32-bit full precision, Memory needed to train model 24GB @ 32-bit full precision. </p><p>Options to reduce the memory:</p><ul><li><p>Quantization : reduce the precision to 16-bit floating point or 8-bit integer</p><p></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!tbEg!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2fe1be02-6edb-4666-af0c-02f0c1d48e91_1263x566.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!tbEg!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2fe1be02-6edb-4666-af0c-02f0c1d48e91_1263x566.png 424w, https://substackcdn.com/image/fetch/$s_!tbEg!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2fe1be02-6edb-4666-af0c-02f0c1d48e91_1263x566.png 848w, https://substackcdn.com/image/fetch/$s_!tbEg!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2fe1be02-6edb-4666-af0c-02f0c1d48e91_1263x566.png 1272w, https://substackcdn.com/image/fetch/$s_!tbEg!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2fe1be02-6edb-4666-af0c-02f0c1d48e91_1263x566.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!tbEg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2fe1be02-6edb-4666-af0c-02f0c1d48e91_1263x566.png" width="1263" height="566" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2fe1be02-6edb-4666-af0c-02f0c1d48e91_1263x566.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:566,&quot;width&quot;:1263,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:227805,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!tbEg!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2fe1be02-6edb-4666-af0c-02f0c1d48e91_1263x566.png 424w, https://substackcdn.com/image/fetch/$s_!tbEg!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2fe1be02-6edb-4666-af0c-02f0c1d48e91_1263x566.png 848w, https://substackcdn.com/image/fetch/$s_!tbEg!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2fe1be02-6edb-4666-af0c-02f0c1d48e91_1263x566.png 1272w, https://substackcdn.com/image/fetch/$s_!tbEg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2fe1be02-6edb-4666-af0c-02f0c1d48e91_1263x566.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!S1V1!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fcb60a9-5c4a-4e2e-87a9-5668d0d6acfa_1216x607.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!S1V1!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fcb60a9-5c4a-4e2e-87a9-5668d0d6acfa_1216x607.png 424w, https://substackcdn.com/image/fetch/$s_!S1V1!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fcb60a9-5c4a-4e2e-87a9-5668d0d6acfa_1216x607.png 848w, https://substackcdn.com/image/fetch/$s_!S1V1!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fcb60a9-5c4a-4e2e-87a9-5668d0d6acfa_1216x607.png 1272w, https://substackcdn.com/image/fetch/$s_!S1V1!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fcb60a9-5c4a-4e2e-87a9-5668d0d6acfa_1216x607.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!S1V1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fcb60a9-5c4a-4e2e-87a9-5668d0d6acfa_1216x607.png" width="1216" height="607" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3fcb60a9-5c4a-4e2e-87a9-5668d0d6acfa_1216x607.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:607,&quot;width&quot;:1216,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:251702,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!S1V1!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fcb60a9-5c4a-4e2e-87a9-5668d0d6acfa_1216x607.png 424w, https://substackcdn.com/image/fetch/$s_!S1V1!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fcb60a9-5c4a-4e2e-87a9-5668d0d6acfa_1216x607.png 848w, https://substackcdn.com/image/fetch/$s_!S1V1!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fcb60a9-5c4a-4e2e-87a9-5668d0d6acfa_1216x607.png 1272w, https://substackcdn.com/image/fetch/$s_!S1V1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fcb60a9-5c4a-4e2e-87a9-5668d0d6acfa_1216x607.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>GPU RAM needed to train larger models</p></li><li><p>As model sizes get larger, you will need to split your model across multiple GPUs for training.</p><h3>Efficient multi-GPU compute strategies</h3></li><li><p>If model fits in a single GPU there may not be a need for using multi-GPUs. But even if your model does fit onto a single GPU, there are benefits to using multiple GPUs to speed up your training.</p></li><li><p>Distributed Data Parallel (DDP): replicates LLM on each GPU, only parallelizes data.</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!U54d!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa71401fa-726e-4f27-840e-99ee39694a2a_1187x496.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!U54d!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa71401fa-726e-4f27-840e-99ee39694a2a_1187x496.png 424w, https://substackcdn.com/image/fetch/$s_!U54d!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa71401fa-726e-4f27-840e-99ee39694a2a_1187x496.png 848w, https://substackcdn.com/image/fetch/$s_!U54d!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa71401fa-726e-4f27-840e-99ee39694a2a_1187x496.png 1272w, https://substackcdn.com/image/fetch/$s_!U54d!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa71401fa-726e-4f27-840e-99ee39694a2a_1187x496.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!U54d!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa71401fa-726e-4f27-840e-99ee39694a2a_1187x496.png" width="1187" height="496" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a71401fa-726e-4f27-840e-99ee39694a2a_1187x496.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:496,&quot;width&quot;:1187,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:268073,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!U54d!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa71401fa-726e-4f27-840e-99ee39694a2a_1187x496.png 424w, https://substackcdn.com/image/fetch/$s_!U54d!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa71401fa-726e-4f27-840e-99ee39694a2a_1187x496.png 848w, https://substackcdn.com/image/fetch/$s_!U54d!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa71401fa-726e-4f27-840e-99ee39694a2a_1187x496.png 1272w, https://substackcdn.com/image/fetch/$s_!U54d!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa71401fa-726e-4f27-840e-99ee39694a2a_1187x496.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ul><li><p>Zero Redundancy Optimizer: (ZERO): Reduces memory by distributing (sharding) the model parameters, gradients, and optimizer states across GPUs.</p></li><li><p>Fully Sharded Data Parallel (FSDP): Distibutes data, Optimizer States, gradients and parameters. Must gets weights before and after the forward pass. Helps reduce overall GPU memory utilization, configure level of sharing via Sharind Factor, supports offloading to CPU if needed.</p></li></ul><h3>Scaling Laws and compute-optimal models</h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!D4Xg!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb3a0b54-57f8-4da4-b558-99285337636d_1263x563.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!D4Xg!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb3a0b54-57f8-4da4-b558-99285337636d_1263x563.png 424w, https://substackcdn.com/image/fetch/$s_!D4Xg!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb3a0b54-57f8-4da4-b558-99285337636d_1263x563.png 848w, https://substackcdn.com/image/fetch/$s_!D4Xg!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb3a0b54-57f8-4da4-b558-99285337636d_1263x563.png 1272w, https://substackcdn.com/image/fetch/$s_!D4Xg!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb3a0b54-57f8-4da4-b558-99285337636d_1263x563.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!D4Xg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb3a0b54-57f8-4da4-b558-99285337636d_1263x563.png" width="1263" height="563" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bb3a0b54-57f8-4da4-b558-99285337636d_1263x563.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:563,&quot;width&quot;:1263,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:146695,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!D4Xg!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb3a0b54-57f8-4da4-b558-99285337636d_1263x563.png 424w, https://substackcdn.com/image/fetch/$s_!D4Xg!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb3a0b54-57f8-4da4-b558-99285337636d_1263x563.png 848w, https://substackcdn.com/image/fetch/$s_!D4Xg!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb3a0b54-57f8-4da4-b558-99285337636d_1263x563.png 1272w, https://substackcdn.com/image/fetch/$s_!D4Xg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb3a0b54-57f8-4da4-b558-99285337636d_1263x563.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>Pre-training for domain Adaptation</h3><ul><li><p>Legal language</p></li><li><p>Medical language</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Qy2J!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ced1698-1293-42d5-af46-8cbec7ef695c_1112x644.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Qy2J!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ced1698-1293-42d5-af46-8cbec7ef695c_1112x644.png 424w, https://substackcdn.com/image/fetch/$s_!Qy2J!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ced1698-1293-42d5-af46-8cbec7ef695c_1112x644.png 848w, https://substackcdn.com/image/fetch/$s_!Qy2J!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ced1698-1293-42d5-af46-8cbec7ef695c_1112x644.png 1272w, https://substackcdn.com/image/fetch/$s_!Qy2J!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ced1698-1293-42d5-af46-8cbec7ef695c_1112x644.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Qy2J!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ced1698-1293-42d5-af46-8cbec7ef695c_1112x644.png" width="1112" height="644" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6ced1698-1293-42d5-af46-8cbec7ef695c_1112x644.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:644,&quot;width&quot;:1112,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Qy2J!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ced1698-1293-42d5-af46-8cbec7ef695c_1112x644.png 424w, https://substackcdn.com/image/fetch/$s_!Qy2J!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ced1698-1293-42d5-af46-8cbec7ef695c_1112x644.png 848w, https://substackcdn.com/image/fetch/$s_!Qy2J!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ced1698-1293-42d5-af46-8cbec7ef695c_1112x644.png 1272w, https://substackcdn.com/image/fetch/$s_!Qy2J!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ced1698-1293-42d5-af46-8cbec7ef695c_1112x644.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>During the training of BloombergGPT, the authors used the Chinchilla Scaling Laws to guide the number of parameters in the model and the volume of training data, measured in tokens. The recommendations of Chinchilla are represented by the lines Chinchilla-1, Chinchilla-2 and Chinchilla-3 in the image above, and we can see that BloombergGPT is close to it.</p>]]></content:encoded></item><item><title><![CDATA[Introduction to LLMs and the Generative AI project lifecycle]]></title><description><![CDATA[Gen AI with LLMs course notes]]></description><link>https://roadtoai.substack.com/p/introduction-to-llms-and-the-generative</link><guid isPermaLink="false">https://roadtoai.substack.com/p/introduction-to-llms-and-the-generative</guid><dc:creator><![CDATA[AI with Atlantis]]></dc:creator><pubDate>Wed, 25 Sep 2024 17:29:17 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!5L_i!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5502a7c-9b14-4029-9ac8-888244afbac9_1313x646.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Transformer architecture:</p><ul><li><p>Scales efficiently across multiple GPUs</p></li><li><p>Parallel process data</p></li><li><p>Gives attention to input meaning</p></li><li><p>Pays attention to all the words in a given input sequence.</p></li><li><p>Attention map</p></li><li><p>Self-attention</p></li></ul><p>How does the transformer work?</p><ul><li><p>Split into Encoder and Decoder</p></li><li><p>Tokenizer ( each number represents a position in the vocabulary dictionary). Token may represent a word or part of a word</p></li><li><p>Embedding layer &#8594; Trainable vector embedding network which maps each tokenID to a high dimensional vector space which learns the meaning and context of each token in the input sequence. In the original Transformer arch, embedding size was 512.</p></li><li><p>Positional Encoding mapped to positional embeddings. Input embedding to the self-attention layer is the sum of the input sequence embedding and the positional embeddings. Positional embeddings are required to preserve the order of the tokens in the sequence.</p></li><li><p>The Transformer model also uses residual connections and layer normalization to facilitate training and prevent overfitting. In addition, the authors introduce a positional encoding scheme that encodes the position of each token in the input sequence, enabling the model to capture the order of the sequence without the need for recurrent or convolutional operations.</p></li><li><p>Self attention layers pays attention to different parts of the sequence to better capture the dependency between the tokens. It stores the importance of each token to all other tokens in the sequence. This doesn&#8217;t happen just one, there multiple heads, multi-attention heads. Each each head will learn a different aspect of language. One head entity, another word rhythm, etc.</p></li><li><p>output of attention layer is passed to a Feed forward network. The output of the feedforward network in the decoder are logits proportional to the probability of each token in the vocabulary. This will then pass to a softmax output which normalizes the probability over the entire vocabulary. The most likely predicted token will have the highest probability.</p><p></p></li></ul><p>Generating text with transformers:</p><ul><li><p>Sequence-to-sequence task</p></li><li><p>The encoder output is a deep representation of the input sequence structure and meaning of each token. This is fed to the decoder. The decoder has information from the encoder and the current output of the decoder back to the decoder.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!5L_i!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5502a7c-9b14-4029-9ac8-888244afbac9_1313x646.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5L_i!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5502a7c-9b14-4029-9ac8-888244afbac9_1313x646.png 424w, https://substackcdn.com/image/fetch/$s_!5L_i!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5502a7c-9b14-4029-9ac8-888244afbac9_1313x646.png 848w, https://substackcdn.com/image/fetch/$s_!5L_i!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5502a7c-9b14-4029-9ac8-888244afbac9_1313x646.png 1272w, https://substackcdn.com/image/fetch/$s_!5L_i!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5502a7c-9b14-4029-9ac8-888244afbac9_1313x646.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!5L_i!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5502a7c-9b14-4029-9ac8-888244afbac9_1313x646.png" width="1313" height="646" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a5502a7c-9b14-4029-9ac8-888244afbac9_1313x646.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:646,&quot;width&quot;:1313,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:286995,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!5L_i!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5502a7c-9b14-4029-9ac8-888244afbac9_1313x646.png 424w, https://substackcdn.com/image/fetch/$s_!5L_i!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5502a7c-9b14-4029-9ac8-888244afbac9_1313x646.png 848w, https://substackcdn.com/image/fetch/$s_!5L_i!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5502a7c-9b14-4029-9ac8-888244afbac9_1313x646.png 1272w, https://substackcdn.com/image/fetch/$s_!5L_i!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5502a7c-9b14-4029-9ac8-888244afbac9_1313x646.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Source: Generative AI with LLMs, Coursera/AWS course.</p><p>Summary:</p><ul><li><p>Encoder  encodes inputs (&#8220;prompts&#8221;) with contextual understanding and produced one vector per input token</p></li><li><p>Decoder accepts input tokens and generate new tokens. It uses the information from encoder outputs, &#8220;cross-attention&#8221;.</p></li></ul></li></ul><p>Additional notes on how the transformer is trained:</p><p>In the original Transformer architecture, <strong>the encoder and decoder are trained simultaneously</strong> rather than sequentially. The training process doesn't involve training the encoder first and then the decoder later. Instead, both the encoder and decoder work together as part of the overall model during the training phase, and they are updated jointly as the model learns from data. Here's how the training process works:</p><h3>Transformer Architecture Overview:</h3><ul><li><p>The <strong>encoder</strong> processes the input sequence (e.g., a sentence) and generates a sequence of continuous representations.</p></li><li><p>The <strong>decoder</strong> takes this encoded information, along with the previous words it has already generated (during training, this includes ground-truth words), to predict the next word in the output sequence (e.g., a translated sentence or another language task).</p></li></ul><h3>Training Process:</h3><ol><li><p><strong>Input Sequence (to the Encoder)</strong>:</p><ul><li><p>The input sentence is tokenized (split into words or subword units) and embedded into vectors, which are passed to the encoder layers.</p></li><li><p>The encoder consists of multiple layers, each with a multi-head self-attention mechanism and feedforward networks. The output of the encoder is a set of context-rich representations of the input sequence.</p></li></ul></li><li><p><strong>Target Sequence (to the Decoder)</strong>:</p><ul><li><p>The decoder gets the encoded input representations from the encoder, and during training, it also receives the correct previous words (ground-truth) of the output sentence. This is done in a process called <strong>teacher forcing</strong>, where the decoder is provided with the true previous words instead of its own predictions.</p></li><li><p>The decoder has multiple layers similar to the encoder but also includes <strong>multi-head attention</strong> over the encoder&#8217;s output (in addition to self-attention over its own input).</p></li></ul></li><li><p><strong>Loss Calculation</strong>:</p><ul><li><p>The model computes the loss based on the difference between the predicted next word and the actual word from the ground-truth sequence.</p></li><li><p>This is typically done using a <strong>cross-entropy loss</strong> function, which measures how well the predicted probability distribution matches the actual target word distribution.</p></li></ul></li><li><p><strong>Backpropagation and Joint Weight Updates</strong>:</p><ul><li><p>The error signals (gradients) from the loss are propagated backward through both the decoder and encoder.</p></li><li><p>The weights in both the encoder and decoder are updated together during each training step through <strong>backpropagation</strong> and <strong>gradient descent</strong> (or similar optimization algorithms like Adam).</p></li><li><p>The entire model &#8212; encoder, decoder, and all attention mechanisms &#8212; learns jointly.</p></li></ul></li></ol><h3>Key Insights:</h3><ul><li><p><strong>Parallelism</strong>: The Transformer does not process inputs sequentially like RNNs. Both the encoder and decoder layers leverage self-attention, which allows parallel computation across all tokens in a sequence, significantly speeding up training.</p></li><li><p><strong>Training Objective</strong>: During training, both the encoder and decoder are optimized to minimize the loss, and the decoder&#8217;s predictions are improved by looking at both its own past outputs and the encoded representations of the input.</p></li></ul><h3>Inference:</h3><ul><li><p>During inference (when generating sequences), the decoder generates words one by one, feeding each generated word back into the decoder until the entire output sequence is produced.</p></li></ul><p></p><p>Variations of Transformers:</p><ul><li><p>Encoder only models: Classification tasks, example: BERT</p></li><li><p>Encoder Decoder models: Sequence-to-sequence tasks like translation, general text generation, Example: BART, T5</p></li><li><p>Decoder only models:  Generalize to most tasks. Example: Llama, GPT, Bloom</p></li></ul><h3>Question: How are subwords reconstructed after token decoding</h3><p>When words are tokenized into subwords during the encoding process, these subwords need to be reconstructed back into full words after decoding. This process typically happens as follows:</p><h3>1. <strong>Tokenization into Subwords</strong>:</h3><ul><li><p>Many tokenizers (like Byte-Pair Encoding (BPE), WordPiece, or SentencePiece) split words into smaller units, called subwords, to handle out-of-vocabulary words and reduce the overall size of the vocabulary.</p></li><li><p>For example, the word &#8220;unhappiness&#8221; could be split into <code>un</code>, <code>happiness</code>, or further into <code>un</code>, <code>happi</code>, <code>ness</code>.</p></li></ul><h3>2. <strong>Decoding Process</strong>:</h3><ul><li><p>After decoding, the model generates a sequence of subword tokens. This could be a mix of complete words and parts of words (subwords).</p></li><li><p>These subwords are then reconstructed back into the original words during post-processing.</p></li></ul><h3>3. <strong>Subword Reconstruction</strong>:</h3><ul><li><p><strong>Concatenation rules</strong>: Most subword tokenization algorithms use special markers to denote whether a token is a standalone word or part of a word. This helps in the reconstruction process:</p><ul><li><p>In <strong>BPE</strong> or <strong>WordPiece</strong>, a common convention is to use a continuation marker (like <code>##</code> in BERT or just not adding space) to indicate that a subword token should be attached to the preceding subword.</p></li><li><p>For example, the tokens <code>happi</code>, <code>##ness</code> would be reconstructed as <code>happiness</code> since the <code>##</code> marker tells the model to attach the subword <code>ness</code> to the preceding token without a space.</p></li><li><p><strong>SentencePiece</strong> uses a slightly different method, where spaces before tokens are explicitly encoded, so the model knows which tokens should be concatenated.</p></li></ul></li></ul><h3>4. <strong>Example</strong>:</h3><p>Let&#8217;s say a sentence is tokenized into subwords like this:</p><pre><code>Original sentence: "I am running fast" 
Subwords: ["I", "am", "runn", "##ing", "fast"]</code></pre><p>After decoding, the subwords might look like:</p><pre><code>["I", "am", "runn", "##ing", "fast"]</code></pre><p>To reconstruct the sentence:</p><ul><li><p>The subword <code>##ing</code> is concatenated with <code>runn</code> to form the word "running."</p></li><li><p>Other tokens are already full words, so no changes are needed for them.</p></li></ul><p>The final output would be:</p><pre><code>"I am running fast"</code></pre><p>In-Context learning(ICL) </p><ul><li><p>Zero shot inference: No examples in the prompt.</p></li><li><p>One shot inference: One example in the prompt.</p></li><li><p>Few shot inference: 5 or 6 examples in the prompt.</p></li></ul><p>Generative Configuration - Inference parameters:</p><ul><li><p>Max new tokens: Maximum number of tokens to generate. The model can also stop generating if it predicts the stop token as the next word.</p></li><li><p>Sample top K: select an output from the top-k results after applying random-weighted strategy using the probabilities.</p></li><li><p>Sample top P: select an output using the random-weighted strategy with the top-ranked consecutive results by probability and with cumulative probability &lt;=P</p></li><li><p>Greedy decoding: The word/token with the highest probability is selected.</p></li><li><p>Random (-weighted) sampling: select a token using random-weighted strategy across the probabilities of all tokens. do_sample=True. Sample to K and Top P are used to limit the options in the random sampling.</p></li><li><p>Temperature:  The higher the temperature , the higher the randomness. Impact the probability distribution.</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!rTSs!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ea66459-0cf8-441c-978b-5bd2c2b5a2eb_1247x551.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!rTSs!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ea66459-0cf8-441c-978b-5bd2c2b5a2eb_1247x551.png 424w, https://substackcdn.com/image/fetch/$s_!rTSs!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ea66459-0cf8-441c-978b-5bd2c2b5a2eb_1247x551.png 848w, https://substackcdn.com/image/fetch/$s_!rTSs!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ea66459-0cf8-441c-978b-5bd2c2b5a2eb_1247x551.png 1272w, https://substackcdn.com/image/fetch/$s_!rTSs!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ea66459-0cf8-441c-978b-5bd2c2b5a2eb_1247x551.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!rTSs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ea66459-0cf8-441c-978b-5bd2c2b5a2eb_1247x551.png" width="1247" height="551" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0ea66459-0cf8-441c-978b-5bd2c2b5a2eb_1247x551.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:551,&quot;width&quot;:1247,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:305592,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!rTSs!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ea66459-0cf8-441c-978b-5bd2c2b5a2eb_1247x551.png 424w, https://substackcdn.com/image/fetch/$s_!rTSs!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ea66459-0cf8-441c-978b-5bd2c2b5a2eb_1247x551.png 848w, https://substackcdn.com/image/fetch/$s_!rTSs!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ea66459-0cf8-441c-978b-5bd2c2b5a2eb_1247x551.png 1272w, https://substackcdn.com/image/fetch/$s_!rTSs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ea66459-0cf8-441c-978b-5bd2c2b5a2eb_1247x551.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2>Generative AI project lifecycle</h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!99Kv!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b71ba52-5fdb-4cb4-9619-781f22adee42_1060x412.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!99Kv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b71ba52-5fdb-4cb4-9619-781f22adee42_1060x412.png 424w, https://substackcdn.com/image/fetch/$s_!99Kv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b71ba52-5fdb-4cb4-9619-781f22adee42_1060x412.png 848w, https://substackcdn.com/image/fetch/$s_!99Kv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b71ba52-5fdb-4cb4-9619-781f22adee42_1060x412.png 1272w, https://substackcdn.com/image/fetch/$s_!99Kv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b71ba52-5fdb-4cb4-9619-781f22adee42_1060x412.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!99Kv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b71ba52-5fdb-4cb4-9619-781f22adee42_1060x412.png" width="1060" height="412" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2b71ba52-5fdb-4cb4-9619-781f22adee42_1060x412.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:412,&quot;width&quot;:1060,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:250744,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!99Kv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b71ba52-5fdb-4cb4-9619-781f22adee42_1060x412.png 424w, https://substackcdn.com/image/fetch/$s_!99Kv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b71ba52-5fdb-4cb4-9619-781f22adee42_1060x412.png 848w, https://substackcdn.com/image/fetch/$s_!99Kv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b71ba52-5fdb-4cb4-9619-781f22adee42_1060x412.png 1272w, https://substackcdn.com/image/fetch/$s_!99Kv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b71ba52-5fdb-4cb4-9619-781f22adee42_1060x412.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ol><li><p>Define the use case as narrowly and as specifically as possible. Good at many tasks? Good at a specific task?</p></li><li><p>Choose an existing model or work on a model from scratch? Most case start with pre-trained model</p></li><li><p>Assess its performance and carry out additional training if needed.</p><ol><li><p>Start with in-context learning: no shot, one shot, few shot</p></li><li><p>Fine-tuning if ICL doesn&#8217;t have acceptable performance</p></li><li><p>Align with human feedback</p></li></ol></li><li><p>Application integration</p><ol><li><p>Optimize and deploy model for inference: efficient use of resources and offering best user experience</p></li><li><p>Augment model and build LLM-powered applications</p></li></ol></li></ol>]]></content:encoded></item><item><title><![CDATA[The ML workflow]]></title><description><![CDATA[The ML workflow on GCP]]></description><link>https://roadtoai.substack.com/p/the-ml-workflow</link><guid isPermaLink="false">https://roadtoai.substack.com/p/the-ml-workflow</guid><dc:creator><![CDATA[AI with Atlantis]]></dc:creator><pubDate>Wed, 25 Sep 2024 12:14:03 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!HjaT!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02413258-a53e-4d83-bfda-091acbfc2c03_551x363.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Overview of ML workflow on GCP</p><ul><li><p>Analogy: Serving food in a restaurant.</p></li></ul><ol><li><p>Data preparation: </p></li></ol><ul><li><p>Two steps: Upload data, Engineer features</p></li><li><p>Data types: Streaming vs batch data, structured vs unstructured data</p><ol start="2"><li><p>Model development</p></li><li><p>Model Serving: Deploy the model, monitor the model</p></li></ol></li></ul><h3>AutoML with Vertex AI</h3><ul><li><p>AutoML : no code, through UI, user friendly</p></li><li><p>Data sources: Cloud storage, BigQuery, Local machine</p><p><strong>Suports:</strong> </p></li><li><p>Image &#8594; Objectives: Image classification ( single or multi-label), image object detection, image segmentation</p></li><li><p>Tabular: Regression/classification, Forecasting</p></li><li><p>text : Classification, entity extraction, sentiment analysis</p></li><li><p>video: video action recognition, video classification, video object tracking</p></li><li><p>AutoML helps you work using multiple data-types to solve a given ML/AI problem.</p></li></ul><h4>Vertext AI feature store</h4><p>A centralized repository to manage, serve, and share features. It Aggregates features from different sources in BigQuery.</p><p>Vertex AI features stores is ready for the challenge of generative AI. It can manage and serve embeddings, which is the crucial data type in gen AI. It also supports retrieving similar items in real time, ensuring low latency.</p><ul><li><p>Real time (online) serving</p></li><li><p>Batch (offline) serving</p></li><li><p>At scale, low latency</p></li></ul><p>Steps</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!AL0G!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5abac15-3ad5-4d0a-92b7-c9e3a6282230_630x212.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!AL0G!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5abac15-3ad5-4d0a-92b7-c9e3a6282230_630x212.png 424w, https://substackcdn.com/image/fetch/$s_!AL0G!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5abac15-3ad5-4d0a-92b7-c9e3a6282230_630x212.png 848w, https://substackcdn.com/image/fetch/$s_!AL0G!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5abac15-3ad5-4d0a-92b7-c9e3a6282230_630x212.png 1272w, https://substackcdn.com/image/fetch/$s_!AL0G!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5abac15-3ad5-4d0a-92b7-c9e3a6282230_630x212.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!AL0G!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5abac15-3ad5-4d0a-92b7-c9e3a6282230_630x212.png" width="630" height="212" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f5abac15-3ad5-4d0a-92b7-c9e3a6282230_630x212.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:212,&quot;width&quot;:630,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:42080,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!AL0G!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5abac15-3ad5-4d0a-92b7-c9e3a6282230_630x212.png 424w, https://substackcdn.com/image/fetch/$s_!AL0G!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5abac15-3ad5-4d0a-92b7-c9e3a6282230_630x212.png 848w, https://substackcdn.com/image/fetch/$s_!AL0G!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5abac15-3ad5-4d0a-92b7-c9e3a6282230_630x212.png 1272w, https://substackcdn.com/image/fetch/$s_!AL0G!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5abac15-3ad5-4d0a-92b7-c9e3a6282230_630x212.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Benefits of feature store</p><p>Features are: shareable for training and serving, reusable, scalable, Easy to use</p><h4>Model Development ( experiment with Recipes: cook then taste)</h4><ul><li><p>Train the model</p></li><li><p>Evaluate the model</p></li></ul><p>Evaluation metrics:</p><p>Confusion matrix:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!HjaT!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02413258-a53e-4d83-bfda-091acbfc2c03_551x363.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!HjaT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02413258-a53e-4d83-bfda-091acbfc2c03_551x363.png 424w, https://substackcdn.com/image/fetch/$s_!HjaT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02413258-a53e-4d83-bfda-091acbfc2c03_551x363.png 848w, https://substackcdn.com/image/fetch/$s_!HjaT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02413258-a53e-4d83-bfda-091acbfc2c03_551x363.png 1272w, https://substackcdn.com/image/fetch/$s_!HjaT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02413258-a53e-4d83-bfda-091acbfc2c03_551x363.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!HjaT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02413258-a53e-4d83-bfda-091acbfc2c03_551x363.png" width="551" height="363" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/02413258-a53e-4d83-bfda-091acbfc2c03_551x363.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:363,&quot;width&quot;:551,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:97664,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!HjaT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02413258-a53e-4d83-bfda-091acbfc2c03_551x363.png 424w, https://substackcdn.com/image/fetch/$s_!HjaT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02413258-a53e-4d83-bfda-091acbfc2c03_551x363.png 848w, https://substackcdn.com/image/fetch/$s_!HjaT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02413258-a53e-4d83-bfda-091acbfc2c03_551x363.png 1272w, https://substackcdn.com/image/fetch/$s_!HjaT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02413258-a53e-4d83-bfda-091acbfc2c03_551x363.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!87qW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F017b6259-871c-42d8-988b-8a7a0dc19c08_681x287.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!87qW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F017b6259-871c-42d8-988b-8a7a0dc19c08_681x287.png 424w, https://substackcdn.com/image/fetch/$s_!87qW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F017b6259-871c-42d8-988b-8a7a0dc19c08_681x287.png 848w, https://substackcdn.com/image/fetch/$s_!87qW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F017b6259-871c-42d8-988b-8a7a0dc19c08_681x287.png 1272w, https://substackcdn.com/image/fetch/$s_!87qW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F017b6259-871c-42d8-988b-8a7a0dc19c08_681x287.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!87qW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F017b6259-871c-42d8-988b-8a7a0dc19c08_681x287.png" width="681" height="287" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/017b6259-871c-42d8-988b-8a7a0dc19c08_681x287.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:287,&quot;width&quot;:681,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:64741,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!87qW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F017b6259-871c-42d8-988b-8a7a0dc19c08_681x287.png 424w, https://substackcdn.com/image/fetch/$s_!87qW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F017b6259-871c-42d8-988b-8a7a0dc19c08_681x287.png 848w, https://substackcdn.com/image/fetch/$s_!87qW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F017b6259-871c-42d8-988b-8a7a0dc19c08_681x287.png 1272w, https://substackcdn.com/image/fetch/$s_!87qW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F017b6259-871c-42d8-988b-8a7a0dc19c08_681x287.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Vertex AI provides: confusion matrix, precision-recall curve, feature importance, Explainable AI</p><h4>Model Serving</h4><ul><li><p>&#8220;Ready to serve the meal&#8221;</p></li><li><p>Deploy model : serve the meal</p></li><li><p>Monitor model: Attend while guests are eating</p></li></ul><p> - Inference types: Endpoint ( real time), Batch predictions ( does not use endpoint)</p><ul><li><p>Vertex AI Pipeline: Automate, Monitor, Govern</p></li><li><p>Vertex AI workbench &#8594; define your own pipeline with prebuilt pipeline components</p></li></ul><h3>MLOps and workflow automation</h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!nu3G!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2817264-a1c5-43a5-9a3f-ff05e7971253_662x325.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!nu3G!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2817264-a1c5-43a5-9a3f-ff05e7971253_662x325.png 424w, https://substackcdn.com/image/fetch/$s_!nu3G!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2817264-a1c5-43a5-9a3f-ff05e7971253_662x325.png 848w, https://substackcdn.com/image/fetch/$s_!nu3G!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2817264-a1c5-43a5-9a3f-ff05e7971253_662x325.png 1272w, https://substackcdn.com/image/fetch/$s_!nu3G!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2817264-a1c5-43a5-9a3f-ff05e7971253_662x325.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!nu3G!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2817264-a1c5-43a5-9a3f-ff05e7971253_662x325.png" width="662" height="325" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c2817264-a1c5-43a5-9a3f-ff05e7971253_662x325.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:325,&quot;width&quot;:662,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:108252,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!nu3G!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2817264-a1c5-43a5-9a3f-ff05e7971253_662x325.png 424w, https://substackcdn.com/image/fetch/$s_!nu3G!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2817264-a1c5-43a5-9a3f-ff05e7971253_662x325.png 848w, https://substackcdn.com/image/fetch/$s_!nu3G!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2817264-a1c5-43a5-9a3f-ff05e7971253_662x325.png 1272w, https://substackcdn.com/image/fetch/$s_!nu3G!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2817264-a1c5-43a5-9a3f-ff05e7971253_662x325.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Practicing MLOps: Automating and monitoring each step of the ML system construction: Continuous integration(CI), continuous training (CT), continuous delivery (CD)</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ITVy!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F103f51ad-83f2-47a6-9f16-8ed7c2f54437_678x341.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ITVy!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F103f51ad-83f2-47a6-9f16-8ed7c2f54437_678x341.png 424w, https://substackcdn.com/image/fetch/$s_!ITVy!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F103f51ad-83f2-47a6-9f16-8ed7c2f54437_678x341.png 848w, https://substackcdn.com/image/fetch/$s_!ITVy!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F103f51ad-83f2-47a6-9f16-8ed7c2f54437_678x341.png 1272w, https://substackcdn.com/image/fetch/$s_!ITVy!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F103f51ad-83f2-47a6-9f16-8ed7c2f54437_678x341.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ITVy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F103f51ad-83f2-47a6-9f16-8ed7c2f54437_678x341.png" width="678" height="341" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/103f51ad-83f2-47a6-9f16-8ed7c2f54437_678x341.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:341,&quot;width&quot;:678,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:110997,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ITVy!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F103f51ad-83f2-47a6-9f16-8ed7c2f54437_678x341.png 424w, https://substackcdn.com/image/fetch/$s_!ITVy!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F103f51ad-83f2-47a6-9f16-8ed7c2f54437_678x341.png 848w, https://substackcdn.com/image/fetch/$s_!ITVy!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F103f51ad-83f2-47a6-9f16-8ed7c2f54437_678x341.png 1272w, https://substackcdn.com/image/fetch/$s_!ITVy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F103f51ad-83f2-47a6-9f16-8ed7c2f54437_678x341.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Vertex AI pipelines supports Kubeflow Pipelines (KFP), TensorFlow Extended (TFX)</p><p>Pipeline components: Custom component - accomplishes a specific task to tailor to your ML workflow. Pre-built component - reuse or customize standard components to suit your needs.</p><p></p><p>Phase of ML automation:</p><ul><li><p>Phase 0: The starting point, use a GUI-based workflow such as AutoML for training, deployment and serving.</p></li><li><p>Phase 1: Automate parts of the workflow such as the training pipeline, develop building blocks for future use</p></li><li><p>Phase 2: Integrate components to form an entire pipeline</p></li><li><p>Achieve CI, CT, and CD</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!qwj5!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e142357-0a90-45dd-822e-91a0900e8317_585x333.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!qwj5!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e142357-0a90-45dd-822e-91a0900e8317_585x333.png 424w, https://substackcdn.com/image/fetch/$s_!qwj5!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e142357-0a90-45dd-822e-91a0900e8317_585x333.png 848w, https://substackcdn.com/image/fetch/$s_!qwj5!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e142357-0a90-45dd-822e-91a0900e8317_585x333.png 1272w, https://substackcdn.com/image/fetch/$s_!qwj5!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e142357-0a90-45dd-822e-91a0900e8317_585x333.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!qwj5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e142357-0a90-45dd-822e-91a0900e8317_585x333.png" width="585" height="333" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7e142357-0a90-45dd-822e-91a0900e8317_585x333.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:333,&quot;width&quot;:585,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:73568,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!qwj5!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e142357-0a90-45dd-822e-91a0900e8317_585x333.png 424w, https://substackcdn.com/image/fetch/$s_!qwj5!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e142357-0a90-45dd-822e-91a0900e8317_585x333.png 848w, https://substackcdn.com/image/fetch/$s_!qwj5!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e142357-0a90-45dd-822e-91a0900e8317_585x333.png 1272w, https://substackcdn.com/image/fetch/$s_!qwj5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e142357-0a90-45dd-822e-91a0900e8317_585x333.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Vertex AI offerings</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!oNF4!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bf3e2b5-36bf-4250-adb2-32caafbea931_1034x606.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!oNF4!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bf3e2b5-36bf-4250-adb2-32caafbea931_1034x606.png 424w, https://substackcdn.com/image/fetch/$s_!oNF4!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bf3e2b5-36bf-4250-adb2-32caafbea931_1034x606.png 848w, https://substackcdn.com/image/fetch/$s_!oNF4!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bf3e2b5-36bf-4250-adb2-32caafbea931_1034x606.png 1272w, https://substackcdn.com/image/fetch/$s_!oNF4!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bf3e2b5-36bf-4250-adb2-32caafbea931_1034x606.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!oNF4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bf3e2b5-36bf-4250-adb2-32caafbea931_1034x606.png" width="1034" height="606" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1bf3e2b5-36bf-4250-adb2-32caafbea931_1034x606.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:606,&quot;width&quot;:1034,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Vertex product overview&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Vertex product overview" title="Vertex product overview" srcset="https://substackcdn.com/image/fetch/$s_!oNF4!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bf3e2b5-36bf-4250-adb2-32caafbea931_1034x606.png 424w, https://substackcdn.com/image/fetch/$s_!oNF4!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bf3e2b5-36bf-4250-adb2-32caafbea931_1034x606.png 848w, https://substackcdn.com/image/fetch/$s_!oNF4!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bf3e2b5-36bf-4250-adb2-32caafbea931_1034x606.png 1272w, https://substackcdn.com/image/fetch/$s_!oNF4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bf3e2b5-36bf-4250-adb2-32caafbea931_1034x606.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><p>Data Science Steps for ML (ref: https://cloud.google.com/architecture/mlops-continuous-delivery-and-automation-pipelines-in-machine-learning)</p><p>After the business case is defined and a success criteria is established, the process of delivering an ML model to production involves the following steps.</p><ol><li><p>Data extraction: You select and integrate the relevant data from various data sources for the ML task.</p></li><li><p>Data analysis: You perform <a href="https://en.wikipedia.org/wiki/Exploratory_data_analysis">exploratory data analysis (EDA)</a> to understand the available data for building the ML model. This process leads to the following:</p><ul><li><p>Understanding the data schema and characteristics that are expected by the model.</p></li><li><p>Identifying the data preparation and feature engineering that are needed for the model.</p></li></ul></li><li><p>Data preparation: The data is prepared for the ML task. This preparation involves data cleaning, where you split the data into training, validation, and test sets. You also apply data transformations and feature engineering to the model that solves the target task. The output of this step are the <em>data splits</em> in the prepared format.</p></li><li><p>Model training: The data scientist implements different algorithms with the prepared data to train various ML models. In addition, you subject the implemented algorithms to hyperparameter tuning to get the best performing ML model. The output of this step is a trained model.</p></li><li><p>Model evaluation: The model is evaluated on a <a href="https://en.wikipedia.org/wiki/Training,_validation,_and_test_sets#Holdout_dataset">holdout test set</a> to evaluate the model quality. The output of this step is a set of metrics to assess the quality of the model.</p></li><li><p>Model validation: The model is confirmed to be adequate for deployment&#8212;that its predictive performance is better than a certain baseline.</p></li><li><p>Model serving: The validated model is deployed to a target environment to serve predictions. This deployment can be one of the following:</p><ul><li><p>Microservices with a REST API to serve online predictions.</p></li><li><p>An embedded model to an edge or mobile device.</p></li><li><p>Part of a batch prediction system.</p></li></ul></li><li><p>Model monitoring: The model predictive performance is monitored to potentially invoke a new iteration in the ML process.</p></li></ol>]]></content:encoded></item><item><title><![CDATA[Generative Adversarial Networks (GANs)]]></title><description><![CDATA[A Generative Adversarial Network (GAN) is a class of machine learning models used for generating new data samples that resemble a given dataset.]]></description><link>https://roadtoai.substack.com/p/generative-adversarial-networks-gans</link><guid isPermaLink="false">https://roadtoai.substack.com/p/generative-adversarial-networks-gans</guid><dc:creator><![CDATA[AI with Atlantis]]></dc:creator><pubDate>Mon, 16 Sep 2024 18:12:58 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!Qf5a!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d414eaf-6f10-46fb-9401-c10d775a498e_1016x455.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>A <strong>Generative Adversarial Network (GAN)</strong> is a class of machine learning models used for generating new data samples that resemble a given dataset. It consists of two neural networks, a <strong>generator</strong> and a <strong>discriminator</strong>, which compete against each other in a game-like setup.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Qf5a!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d414eaf-6f10-46fb-9401-c10d775a498e_1016x455.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Qf5a!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d414eaf-6f10-46fb-9401-c10d775a498e_1016x455.png 424w, https://substackcdn.com/image/fetch/$s_!Qf5a!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d414eaf-6f10-46fb-9401-c10d775a498e_1016x455.png 848w, https://substackcdn.com/image/fetch/$s_!Qf5a!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d414eaf-6f10-46fb-9401-c10d775a498e_1016x455.png 1272w, https://substackcdn.com/image/fetch/$s_!Qf5a!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d414eaf-6f10-46fb-9401-c10d775a498e_1016x455.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Qf5a!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d414eaf-6f10-46fb-9401-c10d775a498e_1016x455.png" width="1016" height="455" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1d414eaf-6f10-46fb-9401-c10d775a498e_1016x455.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:455,&quot;width&quot;:1016,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:31303,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Qf5a!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d414eaf-6f10-46fb-9401-c10d775a498e_1016x455.png 424w, https://substackcdn.com/image/fetch/$s_!Qf5a!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d414eaf-6f10-46fb-9401-c10d775a498e_1016x455.png 848w, https://substackcdn.com/image/fetch/$s_!Qf5a!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d414eaf-6f10-46fb-9401-c10d775a498e_1016x455.png 1272w, https://substackcdn.com/image/fetch/$s_!Qf5a!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1d414eaf-6f10-46fb-9401-c10d775a498e_1016x455.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Figure 1: <a href="https://developers.google.com/machine-learning/gan/discriminator">GAN - with backpropagation in dscriminator training ( highlighted). </a></p><h3>Key Components:</h3><ol><li><p><strong>Generator (G)</strong>:</p><ul><li><p>Its goal is to generate data that looks like the real data (e.g., images, audio).</p></li><li><p>It starts by creating random data (e.g., noise) and learns to produce more realistic samples over time.</p></li></ul></li><li><p><strong>Discriminator (D)</strong>:</p><ul><li><p>Its task is to distinguish between real data (from the dataset) and fake data (generated by the generator).</p></li><li><p>It outputs a probability that a given sample is real or fake.</p></li></ul></li></ol><h3>How GANs Work:</h3><ul><li><p>The <strong>generator</strong> tries to fool the <strong>discriminator</strong> by generating data that looks real, while the <strong>discriminator</strong> tries to correctly classify real vs. fake data.</p></li><li><p>Over time, the <strong>generator</strong> improves, generating more realistic data, and the <strong>discriminator</strong> becomes better at distinguishing real from fake data.</p></li><li><p>The training continues until the generator produces data that is nearly indistinguishable from real data.</p></li></ul><h3>Training the discriminator:</h3><ul><li><p>Input to the discriminator comes from real data instances, e.g. images of real horses and fake data instances generated by the generator to be used as negative examples during training.</p></li><li><p>Focuses only on discriminative loss. Loss includes both types of misclassifications real as fake or fake as real.</p></li><li><p>Weights get updated using back-propagation.</p></li></ul><h3>Training the Generator:</h3><ul><li><p>Generator training involves: the random input, the generator network, the discriminator network, discriminator output and generator loss.</p></li><li><p>The most basic form of GAN takes random noise sampled from a target distribution as its input.</p></li><li><p>The generator loss penalizes the generator for producing a sample that the discriminator network classifies as fake.</p></li><li><p>Training steps:</p><ol><li><p>Calculate loss from the discriminator classification.</p></li><li><p>Backpropagate through both the discriminator and generator to obtain gradients.</p></li><li><p>Update only hte generator weights using gradients.</p></li></ol></li></ul><h3>Training GANs:</h3><p>While training GANs, we alternate training the two networks, taking turns after certain epochs. </p><ol><li><p>Train the discriminator for one or more epochs.</p></li><li><p>Train the generator for one or more epochs.</p></li><li><p>Repeat steps 1 &amp; 2 to continue training both networks.</p></li></ol><p></p><h3>Loss function:</h3><ul><li><p>In the minimax loss function the generator tries to minimize the function while the discriminator tries to maximize it.</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;E_x[log(D(x))]+E_z[log(1-D(G(z)))]&quot;,&quot;id&quot;:&quot;NQLMXDVIDM&quot;}" data-component-name="LatexBlockToDOM"></div><p>Where:</p><ul><li><p>D(x) is the discriminator&#8217;s estimate of the probability that real data instance x is real</p></li><li><p>G(z) is the genrator&#8217;s output for input noise z</p></li><li><p>D(G(z)) is the discriminator&#8217;s estimate of the probability that fake instance z is real</p></li></ul></li></ul><h3>Use Cases:</h3><ul><li><p><strong>Image generation</strong>: Generating realistic images (e.g., deepfake images, art, or animations).</p></li><li><p><strong>Text-to-image</strong>: Generating images from text descriptions.</p></li><li><p><strong>Super-resolution</strong>: Enhancing the resolution of images.</p></li><li><p><strong>Data augmentation</strong>: Creating synthetic data for model training.</p></li></ul><h3>References:</h3><ol><li><p>https://developers.google.com/machine-learning/gan/</p></li><li><p>https://aws.amazon.com/what-is/gan/</p></li><li><p>https://github.com/christianversloot/machine-learning-articles/blob/main/building-a-simple-vanilla-gan-with-pytorch.md</p></li></ol>]]></content:encoded></item><item><title><![CDATA[Recurrent Neural Networks (RNNs)-1/3]]></title><description><![CDATA[Vanilla RNN]]></description><link>https://roadtoai.substack.com/p/recurrent-neural-networks-rnns-13</link><guid isPermaLink="false">https://roadtoai.substack.com/p/recurrent-neural-networks-rnns-13</guid><dc:creator><![CDATA[AI with Atlantis]]></dc:creator><pubDate>Tue, 10 Sep 2024 16:30:28 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!ggA_!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a88c9f8-91ca-4dbd-a19d-bb0c300ca184_144x144.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3>How it Works</h3><p>A Simple RNN is a type of neural network designed to process sequential data. Unlike traditional feedforward neural networks, RNNs have internal memory, allowing them to retain information from previous inputs. This memory is implemented using a hidden state, which is updated at each time step based on the current input and the previous hidden state.</p><p>Mathematical Representation</p><ul><li><p><strong>Input:</strong> A sequence of vectors, x1&#8203;,x2&#8203;,...,xT&#8203;.</p></li><li><p><strong>Hidden State:</strong> A vector, ht&#8203;, representing the network's memory at time step t.</p></li><li><p><strong>Output:</strong> A vector, yt&#8203;, representing the network's prediction at time step t.</p></li></ul><p>The equations governing an RNN are:</p><pre><code><code>h_t = tanh(W_{ih}x_t + W_{hh}h_{t-1} + b_h)
y_t = softmax(W_{ho}h_t + b_o)
</code></code></pre><p>where:</p><ul><li><p>W_{ih} &#8594; input weight&#8203;, W_{hh} &#8594; hidden state weight&#8203;, and W_{ho} &#8594; output weight&#8203; are weight matrices.</p></li><li><p>b_h&#8203; &#8594; bias to hidden layer and b_o&#8203;  bias to output layer are bias vectors.</p></li><li><p>tanh is the hyperbolic tangent activation function.</p></li></ul><h3>Pros and Cons</h3><p><strong>Pros:</strong></p><ul><li><p>Can handle sequential data.</p></li><li><p>Can learn &#8220;long-term&#8221; dependencies.</p></li></ul><p><strong>Cons:</strong></p><ul><li><p>Can suffer from vanishing gradient problems, making it difficult to learn long-term dependencies.</p></li><li><p>Can be computationally expensive for long sequences.</p></li></ul><h3>Weight Computation and Update</h3><p>Weights are typically initialized randomly and then updated during training using backpropagation. The gradient of the loss function with respect to the weights is calculated using the chain rule. The weights are then updated using gradient descent or a variant like Adam.</p><h3>Backpropagation Through Time (BPTT)</h3><p>BPTT is a modified version of backpropagation specifically designed for RNNs. It involves unfolding the RNN over time, creating a computational graph that can be used to calculate gradients. The gradients are then propagated backward through time to update the weights.</p><p><strong>Key steps in BPTT:</strong></p><ol><li><p><strong>Forward pass:</strong> Compute the hidden states and outputs for each time step.</p></li><li><p><strong>Backward pass:</strong> Calculate the gradients of the loss function with respect to the outputs, hidden states, and weights.</p></li><li><p><strong>Weight update:</strong> Update the weights using the calculated gradients.</p></li></ol><p>By using BPTT, RNNs can learn long-term dependencies and improve their performance on sequential tasks.</p><h3><strong>Simple RNN example</strong></h3><p><a href="https://github.com/akessela/deep-learning-code-examples/blob/main/rnn/RNN_intro.ipynb">Here</a> is the notebook I created which demonstrates how a simple RNN can be trained to classify tweets into binary sentiments.</p>]]></content:encoded></item><item><title><![CDATA[Regularization in Neural Networks - Part 2/3]]></title><description><![CDATA[Dropout, early stopping]]></description><link>https://roadtoai.substack.com/p/regularization-in-neural-networks-7f8</link><guid isPermaLink="false">https://roadtoai.substack.com/p/regularization-in-neural-networks-7f8</guid><dc:creator><![CDATA[AI with Atlantis]]></dc:creator><pubDate>Mon, 09 Sep 2024 19:10:16 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!ggA_!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a88c9f8-91ca-4dbd-a19d-bb0c300ca184_144x144.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2><strong>Dropout</strong></h2><p><strong>Dropout</strong> is a popular regularization technique used in neural networks to prevent overfitting by randomly dropping (setting to zero) a fraction of the neurons in a layer during training. This technique reduces the model's reliance on any specific neurons, encouraging it to learn more robust and generalized features.</p><h3>What is Dropout?</h3><p>Dropout is a form of regularization that helps prevent overfitting in neural networks by:</p><ul><li><p><strong>Randomly dropping neurons</strong>: During each training iteration (batch), a certain percentage of neurons (e.g., 20% or 50%) are randomly &#8220;dropped out&#8221; or temporarily deactivated. These neurons do not contribute to the forward pass or backpropagation.</p></li><li><p><strong>Reducing co-adaptation of neurons</strong>: By forcing the network to operate with a subset of its neurons, dropout reduces the likelihood that the network will become overly reliant on specific neurons, promoting redundancy and diversity in feature learning.</p></li></ul><h3>How Dropout Works During Training and Testing</h3><ul><li><p><strong>During Training</strong>:</p><ul><li><p>Each neuron is dropped (set to zero) with a probability p, known as the dropout rate (e.g., 0.5 means 50% of neurons are dropped).</p></li><li><p>The remaining neurons are &#8220;kept&#8221; with probability 1&#8722;p.</p></li><li><p>The weight updates are computed only for the neurons that remain active.</p></li><li><p>Mathematically, the output of a neuron h_i&#8203; at layer l during training becomes:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;h_i(l)=ri&#8901;activation(&#8721;w_{ij}x_j+bi)h_i^{(l)} &quot;,&quot;id&quot;:&quot;SIJTSQAZYM&quot;}" data-component-name="LatexBlockToDOM"></div><p></p><p>where:</p><ul><li><p>ri is a Bernoulli random variable (1 with probability 1&#8722;p, and 0 with probability p).</p></li><li><p>$w_ij$ are the weights, x_j is the input from the previous layer, and $b_i$ is the bias.</p></li></ul></li><li><p>This effectively means that each forward pass during training uses a different "thinned" network, with only a random subset of neurons active.</p></li></ul></li><li><p><strong>During Testing</strong>:</p><ul><li><p>No neurons are dropped. Instead, all neurons are used, but their outputs are scaled by a factor equal to the dropout rate (1&#8722;p).</p></li><li><p>This scaling compensates for the fact that more neurons are active during testing than in any single forward pass during training.</p></li></ul></li></ul><h3>Why Dropout is Used for Regularization</h3><ul><li><p><strong>Prevents Overfitting</strong>: By randomly dropping neurons during training, dropout prevents the network from becoming overly specialized to the training data, making it less likely to overfit.</p></li><li><p><strong>Encourages Redundancy and Robustness</strong>: Since neurons cannot rely on specific other neurons being active, they must learn more robust features that are useful in combination with many different subsets of neurons.</p></li><li><p><strong>Acts as an Implicit Ensemble Method</strong>: Training with dropout can be thought of as training many different, smaller networks that share weights. At test time, using the full network is like taking an average prediction from this ensemble, which is often more robust.</p></li></ul><h2>Early Stoping</h2><ul><li><p>Choose some conditions after which to stop training</p><ul><li><p>Example: Check the validation log-loss every 5 epoch. If it&#8217;s higher than the previous loss value, stop and use the previous model.</p></li></ul></li></ul>]]></content:encoded></item><item><title><![CDATA[Regularization in neural networks - part 1/3]]></title><description><![CDATA[Deep Learning fundamentals series]]></description><link>https://roadtoai.substack.com/p/regularization-in-neural-networks</link><guid isPermaLink="false">https://roadtoai.substack.com/p/regularization-in-neural-networks</guid><dc:creator><![CDATA[AI with Atlantis]]></dc:creator><pubDate>Mon, 09 Sep 2024 17:56:42 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!PloG!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1835aba0-e79c-4cf5-b99e-9c84ca7c5c56_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2>Regularizing neural networks</h2><ul><li><p>Regularization penalty in cost function</p></li><li><p>Dropout</p></li><li><p>Early stopping</p></li><li><p>Stochastic/ mini-batch gradient descent (to some degree)</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!PloG!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1835aba0-e79c-4cf5-b99e-9c84ca7c5c56_1024x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!PloG!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1835aba0-e79c-4cf5-b99e-9c84ca7c5c56_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!PloG!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1835aba0-e79c-4cf5-b99e-9c84ca7c5c56_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!PloG!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1835aba0-e79c-4cf5-b99e-9c84ca7c5c56_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!PloG!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1835aba0-e79c-4cf5-b99e-9c84ca7c5c56_1024x1024.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!PloG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1835aba0-e79c-4cf5-b99e-9c84ca7c5c56_1024x1024.png" width="390" height="390" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1835aba0-e79c-4cf5-b99e-9c84ca7c5c56_1024x1024.png&quot;,&quot;srcNoWatermark&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/48dcc27a-355d-442a-b867-89d8eebd7d53_1024x1024.webp&quot;,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:1024,&quot;resizeWidth&quot;:390,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;A conceptual illustration of regularization in neural networks using penalized loss functions. The image should depict a stylized neural network with multiple interconnected nodes and layers. Around the network, visualize mathematical symbols representing regularization techniques like L1 (lasso) and L2 (ridge) norms. Include visual elements such as a balancing scale to symbolize the balance between minimizing loss and avoiding overfitting. Add visual cues like weight penalties (chains or constraints) on the connections between nodes to represent penalized loss functions. The background should be light with a focus on the central concept.&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="A conceptual illustration of regularization in neural networks using penalized loss functions. The image should depict a stylized neural network with multiple interconnected nodes and layers. Around the network, visualize mathematical symbols representing regularization techniques like L1 (lasso) and L2 (ridge) norms. Include visual elements such as a balancing scale to symbolize the balance between minimizing loss and avoiding overfitting. Add visual cues like weight penalties (chains or constraints) on the connections between nodes to represent penalized loss functions. The background should be light with a focus on the central concept." title="A conceptual illustration of regularization in neural networks using penalized loss functions. The image should depict a stylized neural network with multiple interconnected nodes and layers. Around the network, visualize mathematical symbols representing regularization techniques like L1 (lasso) and L2 (ridge) norms. Include visual elements such as a balancing scale to symbolize the balance between minimizing loss and avoiding overfitting. Add visual cues like weight penalties (chains or constraints) on the connections between nodes to represent penalized loss functions. The background should be light with a focus on the central concept." srcset="https://substackcdn.com/image/fetch/$s_!PloG!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1835aba0-e79c-4cf5-b99e-9c84ca7c5c56_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!PloG!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1835aba0-e79c-4cf5-b99e-9c84ca7c5c56_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!PloG!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1835aba0-e79c-4cf5-b99e-9c84ca7c5c56_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!PloG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1835aba0-e79c-4cf5-b99e-9c84ca7c5c56_1024x1024.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div></li></ul><h3>Penalized cost function</h3><p>A penalized cost function helps in neural network regularization by adding a penalty term to the original cost function, which discourages the model from fitting too closely to the training data. This approach helps prevent overfitting, where the neural network learns noise and random fluctuations in the training data rather than the underlying patterns.</p><h5>How Penalized Cost Functions Work</h5><p>A penalized cost function modifies the original cost function (often the mean squared error or cross-entropy loss) by adding a regularization term. The two most common types of regularization terms are:</p><p>1. <strong>L1 Regularization (Lasso)</strong>:</p><p>   - Adds the sum of the absolute values of the weights to the cost function.</p><p>   - Penalized cost function:  </p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot; \n\n   J(\\theta) = J_{original}(\\theta) + \\lambda \\sum_{i} |w_i|\n\n   &quot;,&quot;id&quot;:&quot;AUTRXAHTIE&quot;}" data-component-name="LatexBlockToDOM"></div><p>   - Encourages sparsity in the weight matrix, which can lead to feature selection (some weights become exactly zero).</p><p>2. <strong>L2 Regularization (Ridge):</strong></p><p>   - Adds the sum of the squared values of the weights to the cost function.</p><p>   - Penalized cost function:  </p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;   \n\n   J(\\theta) = J_{original}(\\theta) + \\lambda \\sum_{i} w_i^2\n\n   \n\n&quot;,&quot;id&quot;:&quot;FVTRXASXQN&quot;}" data-component-name="LatexBlockToDOM"></div><p></p><p>   - Encourages smaller weight values, reducing the complexity of the model.</p><p>Here, Joriginal(&#952;) is the original loss (cost) function, &#955; is the regularization hyperparameter that controls the strength of the penalty, and wi represents the individual weights of the neural network.</p><ol start="3"><li><p><strong>Elastic Net Regularization</strong></p><p>The elastic net combines both L1 and L2 regularizations. It&#8217;s used when both sparsity and small weights are desired.</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;J(\\theta) = J_{original}(\\theta) + \\frac{\\lambda_1}{m}\\sum{_{j=1}^n}|w_j| +  \\frac{\\lambda_2}{2m}\\sum{_{j=1}^n}|w{_j^2}| &quot;,&quot;id&quot;:&quot;EMWMGMYDPU&quot;}" data-component-name="LatexBlockToDOM"></div><p></p></li></ol><p><strong>How Regularization Works</strong></p><p>- <strong>Reduces Model Complexity:</strong> By penalizing large weights, the model is less likely to have high variance (overfit). Large weights often indicate that the model is trying to fit the training data too closely.</p><p>- <strong>Encourages Generalization</strong>: The added penalty encourages the model to find a simpler decision boundary or function that generalizes better to unseen data.</p><p><strong>Pros and Cons of Penalized Cost Functio</strong>ns</p><p>- <strong>Pros</strong>:</p><p>  - <strong>Reduces Overfitting</strong>: Helps the model generalize to new data by preventing it from becoming too complex.</p><p>  - <strong>Improves Model Robustness</strong>: Especially useful in high-dimensional datasets where there is a risk of overfitting.</p><p>- <strong>Cons</strong>:</p><p>  - <strong>Computational Cost</strong>: May increase the computational complexity, especially in large networks.</p><p>  - <strong>Requires Hyperparameter Tuning</strong>: Choosing the right regularization strength (&#955;) is critical; too high may lead to underfitting, and too low may not effectively prevent overfitting.</p><p><strong>When to Use Penalized Cost Functions</strong></p><p>- <strong>When Dealing with High-Dimensional Data</strong>: Regularization is particularly useful when you have many features (parameters) and the risk of overfitting is high.</p><p>- <strong>When the Model is Overfitting</strong>: If your model performs well on the training data but poorly on the test data, regularization can help improve its generalization.</p><p>- <strong>When Sparse or Simpler Models are Desired</strong>: L1 regularization is useful when you want a sparse model, while L2 is preferred when you want to control the magnitude of the weights.</p><p>By using penalized cost functions, neural networks become more resistant to overfitting, thus improving their ability to generalize to unseen data.</p>]]></content:encoded></item><item><title><![CDATA[AI Development options]]></title><description><![CDATA[My notes from GCP machine learning certification prep course]]></description><link>https://roadtoai.substack.com/p/ai-development-options</link><guid isPermaLink="false">https://roadtoai.substack.com/p/ai-development-options</guid><dc:creator><![CDATA[AI with Atlantis]]></dc:creator><pubDate>Thu, 05 Sep 2024 02:23:09 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!QOk6!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feafd416b-aebe-4365-8620-5e9d5a582697_1289x559.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Which solution to choose depends on data type, available training data size, ML and cording expertise and if there is a need to tune hyper-parameters.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!QOk6!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feafd416b-aebe-4365-8620-5e9d5a582697_1289x559.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!QOk6!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feafd416b-aebe-4365-8620-5e9d5a582697_1289x559.png 424w, https://substackcdn.com/image/fetch/$s_!QOk6!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feafd416b-aebe-4365-8620-5e9d5a582697_1289x559.png 848w, https://substackcdn.com/image/fetch/$s_!QOk6!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feafd416b-aebe-4365-8620-5e9d5a582697_1289x559.png 1272w, https://substackcdn.com/image/fetch/$s_!QOk6!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feafd416b-aebe-4365-8620-5e9d5a582697_1289x559.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!QOk6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feafd416b-aebe-4365-8620-5e9d5a582697_1289x559.png" width="1289" height="559" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/eafd416b-aebe-4365-8620-5e9d5a582697_1289x559.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:559,&quot;width&quot;:1289,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:268232,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!QOk6!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feafd416b-aebe-4365-8620-5e9d5a582697_1289x559.png 424w, https://substackcdn.com/image/fetch/$s_!QOk6!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feafd416b-aebe-4365-8620-5e9d5a582697_1289x559.png 848w, https://substackcdn.com/image/fetch/$s_!QOk6!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feafd416b-aebe-4365-8620-5e9d5a582697_1289x559.png 1272w, https://substackcdn.com/image/fetch/$s_!QOk6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feafd416b-aebe-4365-8620-5e9d5a582697_1289x559.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ul><li><p>Have little ML expertise or no intention to train a model? Use Pre-trained APIs</p></li><li><p>Familiar with SQL and have data in BigQuery? BigQuery ML</p></li><li><p>Want to build custom models with your own training data with minimal coding? AutoML</p></li><li><p>Want full control of the ML workflow? Custom training</p><p></p></li></ul><h3>Pre-trained APIs</h3><ul><li><p>Offered as a service</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!K7E2!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ef4834a-9aa9-4058-bda6-0d1067624015_1204x261.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!K7E2!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ef4834a-9aa9-4058-bda6-0d1067624015_1204x261.png 424w, https://substackcdn.com/image/fetch/$s_!K7E2!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ef4834a-9aa9-4058-bda6-0d1067624015_1204x261.png 848w, https://substackcdn.com/image/fetch/$s_!K7E2!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ef4834a-9aa9-4058-bda6-0d1067624015_1204x261.png 1272w, https://substackcdn.com/image/fetch/$s_!K7E2!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ef4834a-9aa9-4058-bda6-0d1067624015_1204x261.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!K7E2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ef4834a-9aa9-4058-bda6-0d1067624015_1204x261.png" width="1204" height="261" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7ef4834a-9aa9-4058-bda6-0d1067624015_1204x261.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:261,&quot;width&quot;:1204,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:141420,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!K7E2!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ef4834a-9aa9-4058-bda6-0d1067624015_1204x261.png 424w, https://substackcdn.com/image/fetch/$s_!K7E2!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ef4834a-9aa9-4058-bda6-0d1067624015_1204x261.png 848w, https://substackcdn.com/image/fetch/$s_!K7E2!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ef4834a-9aa9-4058-bda6-0d1067624015_1204x261.png 1272w, https://substackcdn.com/image/fetch/$s_!K7E2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ef4834a-9aa9-4058-bda6-0d1067624015_1204x261.png 1456w" sizes="100vw"></picture><div></div></div></a></figure></div><h4>Natural Language API</h4></li><li><p><strong>Entity analysis</strong></p></li><li><p>Automatic tagging of keywords across many documents</p></li><li><p>Classification of documents into different categories based on key information</p></li><li><p>Extraction of information to generate summaries bases on key entities</p></li><li><p>The salience score for an entity provides information about the importance or centrality of that entity to the entire document text. Scores closer to 0 are less salient, while scores closer to 1.0 are highly salient.</p><p><strong>Sentiment Analysis</strong></p></li><li><p>Customer feedback</p></li><li><p>Social network comments</p></li><li><p>Conversations</p><p><strong>Syntax</strong></p></li></ul><p>Parts of speech, dependency, Lemma, Morphology, Parse label</p><p>Categories</p><h5><strong>Generative AI APIs</strong></h5><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!bOfZ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e8649a7-ad5a-4e04-a055-95843d1d634b_1147x416.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!bOfZ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e8649a7-ad5a-4e04-a055-95843d1d634b_1147x416.png 424w, https://substackcdn.com/image/fetch/$s_!bOfZ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e8649a7-ad5a-4e04-a055-95843d1d634b_1147x416.png 848w, https://substackcdn.com/image/fetch/$s_!bOfZ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e8649a7-ad5a-4e04-a055-95843d1d634b_1147x416.png 1272w, https://substackcdn.com/image/fetch/$s_!bOfZ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e8649a7-ad5a-4e04-a055-95843d1d634b_1147x416.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!bOfZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e8649a7-ad5a-4e04-a055-95843d1d634b_1147x416.png" width="1147" height="416" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0e8649a7-ad5a-4e04-a055-95843d1d634b_1147x416.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:416,&quot;width&quot;:1147,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:104597,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!bOfZ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e8649a7-ad5a-4e04-a055-95843d1d634b_1147x416.png 424w, https://substackcdn.com/image/fetch/$s_!bOfZ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e8649a7-ad5a-4e04-a055-95843d1d634b_1147x416.png 848w, https://substackcdn.com/image/fetch/$s_!bOfZ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e8649a7-ad5a-4e04-a055-95843d1d634b_1147x416.png 1272w, https://substackcdn.com/image/fetch/$s_!bOfZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e8649a7-ad5a-4e04-a055-95843d1d634b_1147x416.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>Vertex AI</h3><h3>AutoML</h3><h3>Custom training</h3>]]></content:encoded></item><item><title><![CDATA[Google Cloud AI/ML fundamentals]]></title><description><![CDATA[My notes from introduction to AI and Machine Learning fundamentals]]></description><link>https://roadtoai.substack.com/p/gcp-fundamentals</link><guid isPermaLink="false">https://roadtoai.substack.com/p/gcp-fundamentals</guid><dc:creator><![CDATA[AI with Atlantis]]></dc:creator><pubDate>Wed, 04 Sep 2024 19:04:33 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!SjUl!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76633137-341b-401e-be9f-c27e4db55e1a_660x301.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3>The three high level layers of GCP stack.</h3><p><strong>Layer 2 Data and AI products  </strong></p><ul><li><p>AI Solutions: Vertical Solutions and horizontal solutions </p></li><li><p>AI Development  Predictive and Generative AI: Pre-trained APIs, BigQuery ML, AutoML, Custom training</p></li></ul><p><strong>Layer 1 Compute | Storage</strong></p><ul><li><p>AI foundations: Cloud essentials, Compute and Storage (decoupled), Data and AI products</p></li></ul><p><strong>Layer 0 Networking and security</strong></p><h3>Google Cloud Infrastructure</h3><h4>Compute Resources</h4><p>Compute Engine:  IaaS offering, compute, storage and network infra, maximum flexibility</p><p>Google Kubernetes Engine: Containerized applications running on cloud environment rather than individual machines.</p><p>App Engine: fully managed PaaS offering, binds code to libraries, focused on application logic</p><p>Cloud functions: Code execution in response to events, serverless offering, function as a service</p><p>Cloud run: fully managed platform, lets you focus on writing code, automatically scales up and down</p><p>Processing power: TPUs</p><ul><li><p>Domain specific hardware</p></li><li><p>Allows for higher efficiency</p></li><li><p>Faster and more energy efficient</p></li></ul><h4>Storage</h4><p>Unstructured data storage: Cloud Storage</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Khhh!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f7b8a8d-7a54-4917-8a91-7e23a1315366_643x187.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Khhh!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f7b8a8d-7a54-4917-8a91-7e23a1315366_643x187.png 424w, https://substackcdn.com/image/fetch/$s_!Khhh!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f7b8a8d-7a54-4917-8a91-7e23a1315366_643x187.png 848w, https://substackcdn.com/image/fetch/$s_!Khhh!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f7b8a8d-7a54-4917-8a91-7e23a1315366_643x187.png 1272w, https://substackcdn.com/image/fetch/$s_!Khhh!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f7b8a8d-7a54-4917-8a91-7e23a1315366_643x187.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Khhh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f7b8a8d-7a54-4917-8a91-7e23a1315366_643x187.png" width="643" height="187" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8f7b8a8d-7a54-4917-8a91-7e23a1315366_643x187.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:187,&quot;width&quot;:643,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:67458,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Khhh!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f7b8a8d-7a54-4917-8a91-7e23a1315366_643x187.png 424w, https://substackcdn.com/image/fetch/$s_!Khhh!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f7b8a8d-7a54-4917-8a91-7e23a1315366_643x187.png 848w, https://substackcdn.com/image/fetch/$s_!Khhh!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f7b8a8d-7a54-4917-8a91-7e23a1315366_643x187.png 1272w, https://substackcdn.com/image/fetch/$s_!Khhh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f7b8a8d-7a54-4917-8a91-7e23a1315366_643x187.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Source: GCP documentation</p><p>Structured data storage options:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!SjUl!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76633137-341b-401e-be9f-c27e4db55e1a_660x301.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!SjUl!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76633137-341b-401e-be9f-c27e4db55e1a_660x301.png 424w, https://substackcdn.com/image/fetch/$s_!SjUl!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76633137-341b-401e-be9f-c27e4db55e1a_660x301.png 848w, https://substackcdn.com/image/fetch/$s_!SjUl!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76633137-341b-401e-be9f-c27e4db55e1a_660x301.png 1272w, https://substackcdn.com/image/fetch/$s_!SjUl!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76633137-341b-401e-be9f-c27e4db55e1a_660x301.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!SjUl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76633137-341b-401e-be9f-c27e4db55e1a_660x301.png" width="660" height="301" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/76633137-341b-401e-be9f-c27e4db55e1a_660x301.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:301,&quot;width&quot;:660,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:61027,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!SjUl!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76633137-341b-401e-be9f-c27e4db55e1a_660x301.png 424w, https://substackcdn.com/image/fetch/$s_!SjUl!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76633137-341b-401e-be9f-c27e4db55e1a_660x301.png 848w, https://substackcdn.com/image/fetch/$s_!SjUl!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76633137-341b-401e-be9f-c27e4db55e1a_660x301.png 1272w, https://substackcdn.com/image/fetch/$s_!SjUl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76633137-341b-401e-be9f-c27e4db55e1a_660x301.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Source: GCP documentation</p><h3>Data and AI products</h3><p>Data-to-AI workflow</p><ol><li><p>Ingestion and process (gather data from multiple sources</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!pRIe!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76d1542e-7740-4ca5-8efe-33829e85cfae_1588x1030.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!pRIe!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76d1542e-7740-4ca5-8efe-33829e85cfae_1588x1030.png 424w, https://substackcdn.com/image/fetch/$s_!pRIe!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76d1542e-7740-4ca5-8efe-33829e85cfae_1588x1030.png 848w, https://substackcdn.com/image/fetch/$s_!pRIe!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76d1542e-7740-4ca5-8efe-33829e85cfae_1588x1030.png 1272w, https://substackcdn.com/image/fetch/$s_!pRIe!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76d1542e-7740-4ca5-8efe-33829e85cfae_1588x1030.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!pRIe!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76d1542e-7740-4ca5-8efe-33829e85cfae_1588x1030.png" width="1456" height="944" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/76d1542e-7740-4ca5-8efe-33829e85cfae_1588x1030.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:944,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:298642,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!pRIe!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76d1542e-7740-4ca5-8efe-33829e85cfae_1588x1030.png 424w, https://substackcdn.com/image/fetch/$s_!pRIe!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76d1542e-7740-4ca5-8efe-33829e85cfae_1588x1030.png 848w, https://substackcdn.com/image/fetch/$s_!pRIe!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76d1542e-7740-4ca5-8efe-33829e85cfae_1588x1030.png 1272w, https://substackcdn.com/image/fetch/$s_!pRIe!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76d1542e-7740-4ca5-8efe-33829e85cfae_1588x1030.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div></li><li><p>Storage (store data in different types of storage) </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!aV3m!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feae84e29-5a62-49ee-bdf8-d35674571621_1284x1066.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!aV3m!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feae84e29-5a62-49ee-bdf8-d35674571621_1284x1066.png 424w, https://substackcdn.com/image/fetch/$s_!aV3m!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feae84e29-5a62-49ee-bdf8-d35674571621_1284x1066.png 848w, https://substackcdn.com/image/fetch/$s_!aV3m!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feae84e29-5a62-49ee-bdf8-d35674571621_1284x1066.png 1272w, https://substackcdn.com/image/fetch/$s_!aV3m!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feae84e29-5a62-49ee-bdf8-d35674571621_1284x1066.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!aV3m!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feae84e29-5a62-49ee-bdf8-d35674571621_1284x1066.png" width="1284" height="1066" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/eae84e29-5a62-49ee-bdf8-d35674571621_1284x1066.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1066,&quot;width&quot;:1284,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:243890,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!aV3m!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feae84e29-5a62-49ee-bdf8-d35674571621_1284x1066.png 424w, https://substackcdn.com/image/fetch/$s_!aV3m!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feae84e29-5a62-49ee-bdf8-d35674571621_1284x1066.png 848w, https://substackcdn.com/image/fetch/$s_!aV3m!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feae84e29-5a62-49ee-bdf8-d35674571621_1284x1066.png 1272w, https://substackcdn.com/image/fetch/$s_!aV3m!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feae84e29-5a62-49ee-bdf8-d35674571621_1284x1066.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div></li><li><p>Analytics  (analyze the data and visualize the results) </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!0ERY!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb52f31ee-190c-4207-9604-01d00ddd2c9f_1062x628.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!0ERY!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb52f31ee-190c-4207-9604-01d00ddd2c9f_1062x628.png 424w, https://substackcdn.com/image/fetch/$s_!0ERY!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb52f31ee-190c-4207-9604-01d00ddd2c9f_1062x628.png 848w, https://substackcdn.com/image/fetch/$s_!0ERY!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb52f31ee-190c-4207-9604-01d00ddd2c9f_1062x628.png 1272w, https://substackcdn.com/image/fetch/$s_!0ERY!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb52f31ee-190c-4207-9604-01d00ddd2c9f_1062x628.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!0ERY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb52f31ee-190c-4207-9604-01d00ddd2c9f_1062x628.png" width="1062" height="628" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b52f31ee-190c-4207-9604-01d00ddd2c9f_1062x628.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:628,&quot;width&quot;:1062,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:121385,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!0ERY!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb52f31ee-190c-4207-9604-01d00ddd2c9f_1062x628.png 424w, https://substackcdn.com/image/fetch/$s_!0ERY!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb52f31ee-190c-4207-9604-01d00ddd2c9f_1062x628.png 848w, https://substackcdn.com/image/fetch/$s_!0ERY!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb52f31ee-190c-4207-9604-01d00ddd2c9f_1062x628.png 1272w, https://substackcdn.com/image/fetch/$s_!0ERY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb52f31ee-190c-4207-9604-01d00ddd2c9f_1062x628.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div></li><li><p>AI/ML(train an ML model to predict future trends or generate new content)</p><p><strong>AI Development</strong></p></li></ol><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!jw2u!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f9d586e-9a40-478a-8aec-041ca92e5580_772x1038.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!jw2u!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f9d586e-9a40-478a-8aec-041ca92e5580_772x1038.png 424w, https://substackcdn.com/image/fetch/$s_!jw2u!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f9d586e-9a40-478a-8aec-041ca92e5580_772x1038.png 848w, https://substackcdn.com/image/fetch/$s_!jw2u!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f9d586e-9a40-478a-8aec-041ca92e5580_772x1038.png 1272w, https://substackcdn.com/image/fetch/$s_!jw2u!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f9d586e-9a40-478a-8aec-041ca92e5580_772x1038.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!jw2u!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f9d586e-9a40-478a-8aec-041ca92e5580_772x1038.png" width="728" height="978.839378238342" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1f9d586e-9a40-478a-8aec-041ca92e5580_772x1038.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:false,&quot;imageSize&quot;:&quot;normal&quot;,&quot;height&quot;:1038,&quot;width&quot;:772,&quot;resizeWidth&quot;:728,&quot;bytes&quot;:170661,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!jw2u!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f9d586e-9a40-478a-8aec-041ca92e5580_772x1038.png 424w, https://substackcdn.com/image/fetch/$s_!jw2u!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f9d586e-9a40-478a-8aec-041ca92e5580_772x1038.png 848w, https://substackcdn.com/image/fetch/$s_!jw2u!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f9d586e-9a40-478a-8aec-041ca92e5580_772x1038.png 1272w, https://substackcdn.com/image/fetch/$s_!jw2u!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f9d586e-9a40-478a-8aec-041ca92e5580_772x1038.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>AI Solutions</strong></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!4ZnB!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fccb42f74-686b-4299-b0d7-d4cc5d506991_625x379.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!4ZnB!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fccb42f74-686b-4299-b0d7-d4cc5d506991_625x379.png 424w, https://substackcdn.com/image/fetch/$s_!4ZnB!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fccb42f74-686b-4299-b0d7-d4cc5d506991_625x379.png 848w, https://substackcdn.com/image/fetch/$s_!4ZnB!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fccb42f74-686b-4299-b0d7-d4cc5d506991_625x379.png 1272w, https://substackcdn.com/image/fetch/$s_!4ZnB!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fccb42f74-686b-4299-b0d7-d4cc5d506991_625x379.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!4ZnB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fccb42f74-686b-4299-b0d7-d4cc5d506991_625x379.png" width="625" height="379" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ccb42f74-686b-4299-b0d7-d4cc5d506991_625x379.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:379,&quot;width&quot;:625,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:78018,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!4ZnB!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fccb42f74-686b-4299-b0d7-d4cc5d506991_625x379.png 424w, https://substackcdn.com/image/fetch/$s_!4ZnB!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fccb42f74-686b-4299-b0d7-d4cc5d506991_625x379.png 848w, https://substackcdn.com/image/fetch/$s_!4ZnB!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fccb42f74-686b-4299-b0d7-d4cc5d506991_625x379.png 1272w, https://substackcdn.com/image/fetch/$s_!4ZnB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fccb42f74-686b-4299-b0d7-d4cc5d506991_625x379.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>BigQuery ML</h3><ul><li><p>Fully managed storage facility for datasets</p></li><li><p>Fast SQL-based analytics engine</p></li><li><p>Capabilities to build ML model:</p><ul><li><p>Manage the tabular data and execute ML models in one place with just a few steps.</p></li><li><p>Steps:</p><p>ETL data into BigQuery &#8594; Select and preprocess features &#8594; Create the model inside BigQuery &#8594; Evaluate the performance of the trained model &#8594; Use the model to make predictions.</p></li></ul></li><li><p>Model types and ML Ops</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!FP3o!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9456829a-2c5a-498e-bba4-58267f0fcf3a_668x285.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!FP3o!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9456829a-2c5a-498e-bba4-58267f0fcf3a_668x285.png 424w, https://substackcdn.com/image/fetch/$s_!FP3o!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9456829a-2c5a-498e-bba4-58267f0fcf3a_668x285.png 848w, https://substackcdn.com/image/fetch/$s_!FP3o!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9456829a-2c5a-498e-bba4-58267f0fcf3a_668x285.png 1272w, https://substackcdn.com/image/fetch/$s_!FP3o!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9456829a-2c5a-498e-bba4-58267f0fcf3a_668x285.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!FP3o!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9456829a-2c5a-498e-bba4-58267f0fcf3a_668x285.png" width="668" height="285" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9456829a-2c5a-498e-bba4-58267f0fcf3a_668x285.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:285,&quot;width&quot;:668,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:70543,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!FP3o!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9456829a-2c5a-498e-bba4-58267f0fcf3a_668x285.png 424w, https://substackcdn.com/image/fetch/$s_!FP3o!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9456829a-2c5a-498e-bba4-58267f0fcf3a_668x285.png 848w, https://substackcdn.com/image/fetch/$s_!FP3o!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9456829a-2c5a-498e-bba4-58267f0fcf3a_668x285.png 1272w, https://substackcdn.com/image/fetch/$s_!FP3o!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9456829a-2c5a-498e-bba4-58267f0fcf3a_668x285.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div></li></ul><p><code>Query syntax: </code></p><pre><code>Create model

CREATE MODEL `your_dataset.your_model`

OPTIONS(

  model_type='LINEAR_REGRESSION',

  labels=['target_column']

) AS

SELECT

  feature_column1,

  feature_column2,

  ...

  target_column

FROM

  `your_dataset.your_table`;</code></pre><ol start="2"><li><p>Evaluate model:</p><pre><code>SELECT

FROM roc_auc, accuracy, precision, recall FROM

  ML.EVALUATE(MODEL `your_dataset.your_model`)</code></pre></li><li><p>Make predictions:</p><pre><code>SELECT

  ML.PREDICT(MODEL `your_dataset.your_model`,

    (feature_column1, feature_column2, ...)) AS prediction

FROM

  `your_dataset.new_data`;</code></pre><h3></h3><p></p><p></p></li></ol>]]></content:encoded></item><item><title><![CDATA[The 7 Principles of responsible AI]]></title><description><![CDATA[Source: Google ML certification course]]></description><link>https://roadtoai.substack.com/p/the-7-principles-of-responsible-ai</link><guid isPermaLink="false">https://roadtoai.substack.com/p/the-7-principles-of-responsible-ai</guid><dc:creator><![CDATA[AI with Atlantis]]></dc:creator><pubDate>Wed, 04 Sep 2024 16:20:08 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!ggA_!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a88c9f8-91ca-4dbd-a19d-bb0c300ca184_144x144.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>AI should </p><ol><li><p>be socially beneficial</p></li><li><p>avoid creating or reinforcing unfair bias</p></li><li><p>be built and tested for safety</p></li><li><p>be accountable to people</p></li><li><p>incorporate privacy and design principles</p></li><li><p>uphold high standards of scientific excellence</p></li><li><p>be made available for uses that accord with these principles</p></li></ol><p></p><p>#GCP #Google #ResponsibleAI</p>]]></content:encoded></item><item><title><![CDATA[Understanding Confidence Intervals]]></title><description><![CDATA[Understanding Confidence Intervals: A Deep Dive into Statistical Confidence]]></description><link>https://roadtoai.substack.com/p/understanding-confidence-intervals</link><guid isPermaLink="false">https://roadtoai.substack.com/p/understanding-confidence-intervals</guid><dc:creator><![CDATA[AI with Atlantis]]></dc:creator><pubDate>Thu, 22 Aug 2024 14:54:20 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a88c9f8-91ca-4dbd-a19d-bb0c300ca184_144x144.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>When you hear about confidence intervals in statistics, it&#8217;s easy to wonder, &#8220;What does that actually mean?&#8221; Whether you're analyzing election polls, determining product quality, or conducting scientific research, confidence intervals are a crucial tool for making informed decisions based on sample data. In this post, we&#8217;ll break down what confidence intervals are, why they matter, and how they relate to concepts like the Central Limit Theorem (CLT). Plus, we&#8217;ll walk through practical examples to help you understand how to calculate confidence intervals for both sample means and sample proportions.</p><p><strong>What is a Confidence Interval?</strong></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://roadtoai.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Atlantis&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>A confidence interval is a range of values, derived from a sample, that is likely to contain the true population parameter. It&#8217;s often expressed in the form:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\n\n\\text{Confidence Interval} = \\text{Point Estimate} \\pm \\text{Margin of Error}\n\n&quot;,&quot;id&quot;:&quot;JTPEBXSLXM&quot;}" data-component-name="LatexBlockToDOM"></div><p></p><p>This interval gives you a range where you expect the true value (e.g., the true population mean or proportion) to lie, with a certain level of confidence (typically 95% or 99%).</p><p><strong>Key Terms Defined</strong></p><p>- <strong>Population</strong>: The entire group you want to study (e.g., all voters in an election).</p><p>- <strong>Sample</strong>: A subset of the population selected for study (e.g., 100 likely voters).</p><p>- <strong>Point Estimate</strong>: A single value estimate of a population parameter (e.g., sample mean or proportion).</p><p>- <strong>Margin of Error</strong>: The range of uncertainty around the point estimate, reflecting the precision of your sample.</p><p>- <strong>Significance Level (\(\alpha\)):</strong> The probability that the true parameter is not within the confidence interval (e.g., \(\alpha = 0.05\) for a 95% confidence level).</p><p>- <strong>Z-Score (\(Z_{1-\alpha/2}\))</strong>: The critical value that defines the confidence interval&#8217;s bounds, derived from the standard normal distribution.</p><p><strong>The Central Limit Theorem (CLT) and Confidence Intervals</strong></p><p>The Central Limit Theorem (CLT)is a fundamental concept in statistics that states that the distribution of sample means approaches a normal distribution as the sample size increases, regardless of the population's distribution, provided the sample size is sufficiently large (usually \( n \geq 30 \)).</p><p>This is crucial for confidence intervals because it allows us to use the normal distribution to estimate how much sample means or proportions will vary around the true population mean or proportion. Thanks to the CLT, even if the original data is not normally distributed, the sample means will be, allowing us to apply the Z-score for calculating confidence intervals.</p><p><strong>Calculating Confidence Intervals: Sample Mean</strong></p><p>Let&#8217;s start by calculating a confidence interval for a sample mean.</p><p>Suppose you want to estimate the average height of adult women in a city. You take a random sample of 100 women and find that the average height is 65 inches with a standard deviation of 3 inches.</p><p>For a 95% confidence interval:</p><p>1. Determine the Z-Score: For 95% confidence, \( Z_{1-\alpha/2} \) is approximately 1.96.</p><p>2. Calculate the Margin of Error:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot; \\text{Margin of Error} = Z_{1-\\alpha/2} \\times \\frac{\\sigma}{\\sqrt{n}} = 1.96 \\times \\frac{3}{\\sqrt{100}} = 1.96 \\times 0.3 = 0.588&quot;,&quot;id&quot;:&quot;QZXDLHCDSQ&quot;}" data-component-name="LatexBlockToDOM"></div><p>3. Determine the Confidence Interval:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;   \\text{Confidence Interval} = 65 \\pm 0.588 = [64.412, 65.588]&quot;,&quot;id&quot;:&quot;LVXHHPBSKQ&quot;}" data-component-name="LatexBlockToDOM"></div><p>This means you can be 95% confident that the true average height of all adult women in the city is between 64.412 inches and 65.588 inches.</p><p><strong>Calculating Confidence Intervals: Sample Proportion</strong></p><p>Now, let&#8217;s calculate a confidence interval for a sample proportion, such as the proportion of voters who intend to vote for a candidate.</p><p>Suppose in a random sample of 100 likely voters, 56 say they intend to vote for you.</p><p>For a 95% confidence interval:</p><p>1. Determine the Z-Score: Again, for 95% confidence, \( Z_{1-\alpha/2} \) is approximately 1.96.</p><p>2. Calculate the Sample Proportion:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot; p = \\frac{56}{100} = 0.56&quot;,&quot;id&quot;:&quot;CYFCWQZOFY&quot;}" data-component-name="LatexBlockToDOM"></div><p>3. Calculate the Margin of Error:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;  \\text{Margin of Error} = Z_{1-\\alpha/2} \\times \\sqrt{\\frac{p(1-p)}{n}} = 1.96 \\times \\sqrt{\\frac{0.56(0.44)}{100}} = 1.96 \\times \\sqrt{0.002464} = 1.96 \\times 0.0496 = 0.0971&quot;,&quot;id&quot;:&quot;IJMGIFOPMR&quot;}" data-component-name="LatexBlockToDOM"></div><p>4. Determine the Confidence Interval:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;  \\text{Confidence Interval} = 0.56 \\pm 0.0971 = [0.4629, 0.6571]&quot;,&quot;id&quot;:&quot;ERZUVECXVH&quot;}" data-component-name="LatexBlockToDOM"></div><p>This means you can be 95% confident that the true proportion of voters who intend to vote for you is between 46.29% and 65.71%.</p><p><strong>Conclusion</strong></p><p>Confidence intervals are powerful tools for making inferences about a population based on sample data. By understanding the key concepts and how they relate to the Central Limit Theorem, you can better appreciate the precision and reliability of your estimates. Whether you&#8217;re estimating means, proportions, or other parameters, knowing how to calculate and interpret confidence intervals will help you make more informed decisions.</p><p>Stay tuned for more posts on statistical concepts, and feel free to share your thoughts or questions in the comments below!</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://roadtoai.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Atlantis&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Python virtual environment setup for complete beginners]]></title><description><![CDATA[The easy way to setup a python virtual environment using Conda on Windows]]></description><link>https://roadtoai.substack.com/p/python-virtual-environment-setup</link><guid isPermaLink="false">https://roadtoai.substack.com/p/python-virtual-environment-setup</guid><dc:creator><![CDATA[AI with Atlantis]]></dc:creator><pubDate>Thu, 28 Dec 2023 15:05:41 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!ggA_!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a88c9f8-91ca-4dbd-a19d-bb0c300ca184_144x144.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3>Setup Python virtual environment on Windows</h3><p><strong>Step 1: </strong>Install Miniconda for windows.</p><p>There are two options to install Miniconda</p><p>a) Download  and install Minconda executable file from <a href="https://docs.conda.io/projects/miniconda/en/latest/">here</a>. Select the file corresponding to the windows platform.</p><p>b) Run the shell command on Windows command prompt.</p><pre><code>curl https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe -o miniconda.exe
start /wait "" miniconda.exe /S
del miniconda.exe</code></pre><p><strong>Step 2: Setup virtual environment</strong></p><ol><li><p>Open Anaconda Prompt (MiniConda3). Search for anaconda at the search bar to find it.</p></li><li><p>Create a python virtual environment using the following command. </p><p><code>conda create -n playground python=3.10</code></p><p></p><p>The above command creates a virtual environment named playground. Change the python version as needed. To see where the environment is created,  run <code>conda env list.</code></p></li><li><p>Activate the virtual environment using <code>conda activate playground</code></p></li></ol><p>Once the environment is active, you can install python packages using pip install [package name]. Example, to install Jupyter packages, <code>run pip install jupyter</code></p><p><strong>Step 3: Setup visual studio code</strong></p><ol><li><p>Download and install visual studio code from <a href="https://code.visualstudio.com/download">here</a>. Download the windows version.</p></li><li><p>Point visual studio code to a folder. Create a new folder if you don&#8217;t one already. </p></li><li><p>VS Code will ask to install a python extension, please follow the steps and installl the extension.</p></li><li><p>Create a new  .py or jupyter (.ipynb) file. VS code will prompt you to install python and jupyter extensions. Install the extensions.</p></li><li><p>Select the kernel corresponding to the environment you have created earlier. There is a select kernel button on the VS code studio UI. When you click it, it will show you the list of virtual environments available to select.</p></li><li><p>Now you are ready to write your code. <code>print(&#8220;hello world!&#8221;)</code></p><p></p></li></ol><p>If you have found any of the steps wrong,  please let me know I will be happy to update the post based on your feedback. Happy coding and may the compiler be with you!</p><p></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://roadtoai.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Atlantis&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p>]]></content:encoded></item></channel></rss>