<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Alessandro De Simone</title>
    <description>The latest articles on DEV Community by Alessandro De Simone (@alexdesi).</description>
    <link>https://dev.to/alexdesi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F647819%2F56122523-85ae-4fb6-bc00-62f7e827332c.jpeg</url>
      <title>DEV Community: Alessandro De Simone</title>
      <link>https://dev.to/alexdesi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/alexdesi"/>
    <language>en</language>
    <item>
      <title>63 Q&amp;As from Watching Karpathy's LLM Tutorial Twice</title>
      <dc:creator>Alessandro De Simone</dc:creator>
      <pubDate>Tue, 03 Feb 2026 18:55:21 +0000</pubDate>
      <link>https://dev.to/alexdesi/63-qas-from-watching-karpathys-llm-tutorial-twice-1pcl</link>
      <guid>https://dev.to/alexdesi/63-qas-from-watching-karpathys-llm-tutorial-twice-1pcl</guid>
      <description>&lt;p&gt;The video "Deep Dive into LLMs like ChatGPT" by Andrej Karpathy (3.5 hours) is one of the most insightful tutorials on Large Language Models.&lt;/p&gt;

&lt;p&gt;I learned a lot about LLMs by watching and studying it.&lt;/p&gt;

&lt;p&gt;I watched it twice. The first time, I paid attention but didn’t try to understand everything.&lt;/p&gt;

&lt;p&gt;The second time was a much slower process. I paused the video every time Andrej explained a concept worth remembering. Each time, I wrote a question and an answer.&lt;/p&gt;

&lt;p&gt;I tried to reuse Andrej’s explanations as much as possible, but sometimes they were too verbose, so I had to condense them into a few lines. This was an incredible learning exercise, though not a quick one.&lt;/p&gt;

&lt;p&gt;By the end of the video, I had written 63 Q&amp;amp;As, which I polished using ChatGPT, but only to fix grammar and spelling.&lt;/p&gt;

&lt;p&gt;If you’ve watched &lt;a href="https://www.youtube.com/watch?v=7xTGNNLPyMI" rel="noopener noreferrer"&gt;Deep Dive into LLMs like ChatGPT&lt;/a&gt; (and you should), use these Q&amp;amp;As to check what you’ve learned about LLMs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pre-Training
&lt;/h2&gt;

&lt;p&gt;1. What are the three stages to train a Large Language Model (LLM) like ChatGPT?&lt;/p&gt;

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Pre-training: Learning general language patterns from large amounts of text&lt;/li&gt;
&lt;li&gt;Post-training: Supervised Fine-Tuning (SFT)&lt;/li&gt;
&lt;li&gt;RLHF: Reinforcement Learning from Human Feedback&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;2. What is the primary source of data used to pre-train LLMs?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The primary source of data is text scraped from the web.&lt;br&gt;&lt;br&gt;
Common Crawl is one of the major sources of data crawled from the web.&lt;br&gt;&lt;br&gt;
Other sources include books, academic papers, and articles.&lt;br&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;3. What is Common Crawl?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Common Crawl is a nonprofit organization that regularly crawls the web and makes petabytes of web data freely available to the public.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;4. Is raw web-scraped data suitable for training as it is?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;No, the raw data must be filtered in many ways.&lt;br&gt;&lt;br&gt;
Raw data is noisy and full of duplicate content, low-quality text, and irrelevant information. Before training, it requires heavy filtering.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;5. What kinds of filters and cleaning must be applied to raw data for LLM training?&lt;/p&gt;

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Step 1: URL filtering.&lt;br&gt;This involves filtering out URLs and domains we do not want in our dataset. This includes malware, pornographic content, racist material, and more.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Step 2: Text extraction.&lt;br&gt;Web pages extracted by crawlers are in raw HTML. This step removes HTML tags, scripts, and CSS.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Step 3: Language filtering.&lt;br&gt;Select only pages that correspond to a specific language. If we are not interested in creating a model that can chat in Italian, we can filter out all Italian pages.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Other steps: There are various minor steps. One worth mentioning is PII (Personally Identifiable Information) removal.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;6. What is tokenization, and why is it a critical step in training LLMs?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It is about changing the representation of text.&lt;/p&gt;

&lt;p&gt;We want to represent text as sequences of symbols, and the neural network is trained on those sequences.&lt;br&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;7. Why is tokenizing text into sequences using only a few symbols a bad idea?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The sequence length a neural network can process is a very finite and precious resource, and we do not want long sequences made of very few symbols.&lt;br&gt;&lt;br&gt;
A vocabulary size of just two symbols (0 and 1), or even 256 symbols, is too small.&lt;br&gt;&lt;br&gt;
In production language models, we must go beyond 256 symbols.&lt;br&gt;&lt;br&gt;
This is done by running what is called the Byte Pair Encoding (BPE) algorithm.&lt;br&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;8. How does the Byte Pair Encoding algorithm work?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It works by looking for consecutive bytes that occur very frequently.&lt;br&gt;&lt;br&gt;
For example, if the sequence 116 followed by 32 occurs often, we group this pair into a new symbol with ID 256 and replace every occurrence of the pair 116–32 with this new symbol.&lt;br&gt;&lt;br&gt;
We then iterate this algorithm as many times as we wish. Each time we mint a new symbol, the sequence length decreases and the vocabulary size increases.&lt;/p&gt;

&lt;p&gt;This process of converting raw text into these symbols (usually called tokens) is called tokenization.&lt;br&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;9. What is an LLM’s vocabulary size, and why does it matter?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The vocabulary size is the total number of possible tokens.&lt;br&gt;&lt;br&gt;
If the vocabulary is too small, the sequence representing a text becomes enormous.&lt;br&gt;&lt;br&gt;
Shorter sequences are preferable, but not too short, as that would lead to an overly large vocabulary.&lt;/p&gt;

&lt;p&gt;A good vocabulary size turns out to be around 100,000 possible symbols. For example, GPT-4 uses 100,277 tokens.&lt;br&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;10. What is TikTokenizer?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It is a helpful web application that shows how a text is tokenized.&lt;br&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;11. What does Andrej K. mean by "windows of tokens"?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;They are random sequences of tokens extracted from a large corpus of text.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;12. What is a good size for token windows?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Andrej says that 8,000 tokens is a good maximum length, and the minimum size is 0.&lt;br&gt;&lt;br&gt;
This means sequences can be anywhere between 0 and 8,000 tokens long.&lt;br&gt;&lt;br&gt;
According to him, 4,000 or 16,000 tokens work fine as the maximum length too.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;13. What is the neural network of an LLM trained for?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It is trained to predict the next token in a sequence of tokens.&lt;/p&gt;

&lt;p&gt;The goal is to train the model to learn the statistical relationships that describe how tokens follow one another.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;14. What are the input and output of the neural network?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The input is a sequence of tokens, and the output is a prediction of what comes next.&lt;/p&gt;

&lt;p&gt;Since the vocabulary contains around 100,000 possible tokens, the neural network produces exactly that many numbers. Each number represents the probability of a token being the next one in the sequence.&lt;br&gt;&lt;br&gt;
In short, it is making probabilistic guesses about what comes next.&lt;br&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;15. How does pre-training work?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Pre-training is about computing all the parameters and weights of the neural network by feeding it random sequences extracted from the data and adjusting the weights based on the expected next tokens.&lt;/p&gt;

&lt;p&gt;Given the huge amount of data involved, pre-training a model can take months and cost hundreds of millions of dollars.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;16. Why is LLM output described as stochastic?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Because the output can change each time you run inference on the same input sequence.&lt;/p&gt;

&lt;p&gt;The model does not repeat verbatim what it was trained on. Instead it produces responses based on probabilities.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;17. What does inference refer to?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Inference is the process of using a trained model to predict the next tokens for a given prompt.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;18. What happens when the model is not trained?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;An untrained model has randomly initialized weights, so it produces random tokens (non-sensical text).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;19. What has driven NVIDIA’s stock price to such a high level?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Pre-training massive models takes months and requires powerful GPUs. Since every major tech company needs these GPUs for their models, demand has surged, pushing NVIDIA's stock price up sharply.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;20. What is a base model?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A base model is the result of the pre-training stage (the first stage).&lt;br&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;21. How does Andrej K. describe base models?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A base model is a powerful text autocomplete system that creates a remix of the internet.&lt;br&gt;&lt;br&gt;
As Andrej K. said, "It dreams internet pages."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;22. What are some web applications for running models like LLaMA 3?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The company Hyperbolic provides a Web App to run models like LLaMA 3 (and many other models): &lt;a href="https://app.hyperbolic.ai/" rel="noopener noreferrer"&gt;app.hyperbolic.ai&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Another good web service is &lt;a href="https://www.together.ai/" rel="noopener noreferrer"&gt;Together.at&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;23. Can you get useful results from a base model?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Yes you can, but you must prompt the model smartly.&lt;br&gt;&lt;br&gt;
The billions of parameters store lots of knowledge about the world.&lt;/p&gt;

&lt;p&gt;You can elicit that knowledge with a prompt that is likely to be found on a web page.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;&lt;br&gt;
"Here is my top 10 list of landmarks to see in Paris:"&lt;br&gt;&lt;br&gt;
On the internet, there are many web pages that suggest Paris landmarks, so the recollection of the landmarks will be plausible.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;24. Do the parameters store information in a lossless way?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;No. The model stores the knowledge from the documents probabilistically, so it is a kind of lossy compression.&lt;/p&gt;

&lt;p&gt;When information is recollected via inference, content that appears very frequently on the internet has a higher chance of being remembered correctly compared to more infrequent documents.&lt;br&gt;&lt;/p&gt;

&lt;p&gt;So you cannot fully trust the output, since the knowledge is not stored explicitly in the parameters.&lt;br&gt;&lt;br&gt;
It is more a probabilistic recollection of the internet.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;25. What is a few-shot prompt?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It is a prompt that contains some examples before asking a question.&lt;/p&gt;

&lt;p&gt;The model can infer a task from the examples and apply that task to new inputs.&lt;/p&gt;

&lt;p&gt;Example of few-shot prompt:&lt;br&gt;
"butterfly: farfalla, ocean: oceano, whisper: sussurro, mountain: montagna, thunder: fulmine, gentle: gentile, freedom: libertà, umbrella: ombrello, cinnamon: cannella, moonlight: chiar di luna, teacher:"&lt;/p&gt;

&lt;p&gt;Thanks to the examples, the model will infer the Italian translation for the word teacher: insegnante.&lt;/p&gt;

&lt;p&gt;This capability is called in-context learning.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;26. Is it possible to use a base model as an assistant?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Yes, but you must provide a few-shot prompt of a dialog between human and assistant:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;human: ...&lt;/li&gt;
&lt;li&gt;assistant: ...&lt;/li&gt;
&lt;li&gt;human: ...&lt;/li&gt;
&lt;li&gt;assistant: ...&lt;/li&gt;
&lt;li&gt;human: ...&lt;/li&gt;
&lt;li&gt;assistant: ...&lt;/li&gt;
&lt;li&gt;...&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That said, To create a more reliable assistant, the model must be fine-tuned.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Post-Training
&lt;/h2&gt;

&lt;p&gt;27. What is the goal of post-training?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;To create a useful assistant that answers user's questions.&lt;/p&gt;

&lt;p&gt;Pre-training gives the user a powerful autocomplete. Post-training turns that into an assistant that actually tries to help the user.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;28. What is the data input used to post-train the model?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;To train the model to behave like an assistant, we need many thousands of human–assistant conversations.&lt;/p&gt;

&lt;p&gt;These conversations are created by humans, often called labelers.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;29. Pre-training or post-training: which one is more computationally expensive?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The pre-training stage. It can take months and cost millions of pounds. The major cost comes from renting data centers capable of training on huge amounts of data.&lt;/p&gt;

&lt;p&gt;Post-training takes only a few hours, which makes it much cheaper.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;30. How do we tokenize conversations into token sequences?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;We use the same vocabulary of tokens used in pre-training, plus a few extra special tokens added during post-training.&lt;/p&gt;

&lt;p&gt;These special tokens are used to tag the human–assistant conversation.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;&lt;/p&gt;


&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;|im_start|&amp;gt;user&amp;lt;|im_sep|&amp;gt;
What is 2 + 2?
&amp;lt;|im_end|&amp;gt;
&amp;lt;|im_start|&amp;gt;assistant&amp;lt;|im_sep|&amp;gt;
2 + 2 equals 4.
&amp;lt;|im_end|&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/blockquote&gt;

&lt;p&gt;31. What are three important principles contained in the labeling instructions given to human labelers at OpenAI?&lt;/p&gt;

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Helpful&lt;/li&gt;
&lt;li&gt;Truthful&lt;/li&gt;
&lt;li&gt;Harmless&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are only some of the principles contained in the policy manual that labelers need to study to write good answers.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  LLM "Psycology"
&lt;/h2&gt;

&lt;p&gt;32. What is the meaning of "hallucination"?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It is when the model does not have enough knowledge stored in its parameters, but it still generates a response, which is a "best guess" (in terms of probability).&lt;/p&gt;

&lt;p&gt;Since the guess is not based on actual knowledge, it is often false and sometimes absurd.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;33. What are two possible ways to mitigate hallucinations?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;These are two techniques:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Post-training with "I don’t know" examples:&lt;br&gt;
A simple technique is to post-train the model on questions for which it does not know the answer, and explicitly teach it to respond with "I don’t know" (or a similar phrase) instead of guessing.&lt;br&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Web search tool:&lt;br&gt;
Another approach mirrors human behavior: searching for information when the answer is unknown.&lt;br&gt;&lt;br&gt;
Modern LLMs can use web search tools to get useful information and add it to the context window. The model then answers the question using this new information, which greatly improves reliability.&lt;br&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Using these techniques, LLM providers have reduced hallucinations in their models.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;34. How does Andrej describe the context window and the knowledge in the parameters?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The knowledge in the parameters offers a vague recollection (e.g. of something you read one month ago).&lt;br&gt;&lt;br&gt;
The knowledge in the tokens of the context window is like working memory (e.g. recent experiences that are fresh in our mind).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;35. Do LLMs have knowledge of self?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Andrej says that asking questions like "Who are you?" or "Who built you?" is nonsensical.&lt;br&gt;&lt;br&gt;
The model follows the statistical regularities of its training set.&lt;/p&gt;

&lt;p&gt;Old models reply to these kinds of questions with plausible but wrong answers (hallucinations).&lt;/p&gt;

&lt;p&gt;Newer ones are often trained to answer these questions and avoid hallucinations, but that does not make them self-aware.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;36. What is the meaning of "models need tokens to think"?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;With that sentence, Andrej states that LLMs don’t think silently; their "thinking" happens by generating tokens step by step.&lt;/p&gt;

&lt;p&gt;An LLM is trained to predict the next token, so any reasoning must be expressed as a sequence of tokens.&lt;/p&gt;

&lt;p&gt;In the video, he asks the model to solve this math problem:&lt;/p&gt;

&lt;p&gt;"Emily buys 3 apples and 2 oranges. Each orange costs $2. The total cost of all the fruit is $13. What is the cost of apples?"&lt;br&gt;&lt;br&gt;
There are two possible answers:&lt;br&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Only the answer:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$3&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Answer with reasoning tokens:&lt;/li&gt;
&lt;/ul&gt;


&lt;pre class="highlight plaintext"&gt;&lt;code&gt;2 oranges cost $4
13 − 4 = 9
9 / 3 = 3
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;For the second answer, the model writes the intermediate steps.&lt;br&gt;&lt;br&gt;
Those steps are reasoning process (the "thinking). The model uses tokens as a form of working memory to reason through the problem.&lt;/p&gt;

&lt;p&gt;In this case, the answer is much more likely to be correct.&lt;br&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;37. What is a more reliable way to ask ChatGPT to solve math problems?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Just add "Use code" at the end of the question, and the model will generate code that solves the problem (usually Python) and run it to get the response.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;38. Are LLMs good at counting? For example, "How many dots are in this string?"&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;No, LLMs often make mistakes when counting characters or words.&lt;/p&gt;

&lt;p&gt;In this case, adding "Use code" to the prompt will request the LLM to write and run Python code. The response is much more reliable, and you can even check the code’s accuracy.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;39. Are models good at spelling?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;No, because models do not see characters. They see tokens.&lt;br&gt;&lt;br&gt;
For example, if you ask the model to print every third character of a word, the model will probably fail.&lt;/p&gt;

&lt;p&gt;If you ask it to "Use code", you will get a correct response.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Reinforcement Learning
&lt;/h2&gt;

&lt;p&gt;40. Andrej uses the school textbook analogy to introduce Reinforcement Learning for LLMs. Can you tell which are the three classes of information in the textbook?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;In a textbook, you can find the expositions, the problems and solutions, and the practice problems sections:&lt;/p&gt;

&lt;p&gt;The expositions: this is the knowledge base, the explanation of ideas and concepts.&lt;br&gt;&lt;/p&gt;

&lt;p&gt;The problems and solutions: these are sections in the book in which the expert shows how to solve specific problems.&lt;/p&gt;

&lt;p&gt;The practice problems: these are critical for learning—the problems students can use to practice, and the final answers, usually at the end of each chapter in the textbook, but the steps to get to the answer are not present.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;41. How does the textbook analogy map onto an LLM?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The expositions: pre-training stage. The model reads huge amounts of text and learns the statistical correlations between tokens.&lt;/p&gt;

&lt;p&gt;The problems &amp;amp; solutions: post-training stage. Supervised fine-tuning, in which the model is trained on thousands of questions (prompts) and ideal solutions and answers provided by human experts.&lt;br&gt;&lt;/p&gt;

&lt;p&gt;Practice problems: reinforcement learning.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;42. What is a company that publicly shared its Reinforcement Learning approach?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;DeepSeek released a paper in which they talked publicly about their approach to RL in their LLMs and the improvements they obtained.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;43. In the RL stage, is the model trained using questions and correct answers?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;No, and that is the important distinction between Reinforcement Learning and Supervised Fine-Tuning.&lt;br&gt;&lt;br&gt;
The correct answers are not used to train the model.&lt;/p&gt;

&lt;p&gt;In the RL stage, the model generates the solutions and the final answers.&lt;br&gt;&lt;br&gt;
The correct answers are used only to check the correctness of the generated answers.&lt;/p&gt;

&lt;p&gt;A positive or negative reward is given to the model based on the comparison between the model’s answer and the correct answer.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;44. What are models trained with RL usually called?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;They are usually called thinking or reasoning models.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;45. What is the best use of a thinking model?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;To solve problems that require reasoning, like math and coding.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;46. In which cases is it overkill to use a thinking model?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;For factual questions, where no reasoning is necessary.&lt;/p&gt;

&lt;p&gt;It is wasteful to use a thinking model because it requires more tokens and more computation.&lt;br&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;47. Why, in the context of the game Go, does Reinforcement Learning get better results than Supervised Learning?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Supervised learning is based on training a model on matches played by human experts. In this way, the model can be as good as the best players, but it cannot go beyond that.&lt;/p&gt;

&lt;p&gt;With RL, the system plays against itself.&lt;br&gt;&lt;br&gt;
It plays millions of matches, and only the winning ones are rewarded.&lt;br&gt;&lt;br&gt;
In this way, human performance is not a limit.&lt;br&gt;&lt;/p&gt;

&lt;p&gt;In fact, the AlphaGo RL system by Google trained the model using only RL so well that it won against top Go players like Lee Sedol.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;48. What are the kinds of problems that have &lt;strong&gt;verifiable domains&lt;/strong&gt;?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;These are problems in which all candidate solutions are easy to score against a correct answer.&lt;/p&gt;

&lt;p&gt;The scoring and the reward can be done automatically, without human intervention.&lt;/p&gt;

&lt;p&gt;For example, in math problems it is easy to check if the final number is correct.&lt;br&gt;&lt;br&gt;
Logic games like chess and Go are also examples, in which it is possible to verify whether certain moves will end with a win or a loss.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;49. What are the kinds of problems that have unverifiable domains?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;These are problems where the correctness and quality of the response are subjective and hard to measure.&lt;/p&gt;

&lt;p&gt;For example: "Write a joke about pelicans". Machines are bad at understanding humor, so only humans can score this kind of question.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;50. What is the meaning of RLHF?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It is Reinforcement Learning from Human Feedback.&lt;br&gt;
RLHF is a form of RL that requires input from humans.&lt;br&gt;&lt;br&gt;
For example, humans rank or compare different answers based on their quality, providing preference data that helps train the model.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;51. How does RLHF work in practice for unverifiable tasks?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;LLM engineers create and train a separate reward model neural network to imitate human preferences.&lt;br&gt;&lt;br&gt;
This reward model is then used to score responses generated by the LLM, and reinforcement learning is applied to encourage higher-scoring outputs.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;&lt;br&gt;
Prompt: "Write a joke about pelicans" (asked 5 times).&lt;/p&gt;

&lt;p&gt;The LLM produces five different responses: a, b, c, d, e.&lt;/p&gt;

&lt;p&gt;The reward model assigns scores to these responses and ranks them from best to worst, approximating human preferences.&lt;/p&gt;

&lt;p&gt;Reinforcement learning then nudges the model to tell jokes more like the higher-ranked ones, which are potentially funnier.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;52. What is the discriminator-generator gap?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It is much easier to tell whether something is good than to generate it.&lt;br&gt;&lt;br&gt;
You can often spot a bad explanation immediately, but generating a good explanation is much harder.&lt;/p&gt;

&lt;p&gt;That asymmetry is the discriminator–generator gap.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;53. Can you run RLHF as long as you want to improve indefinitely an LLM?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;No, after a certain number of iterations, usually a few hundred updates, the LLM starts degrading.&lt;br&gt;&lt;br&gt;
The reason is that LLMs start finding answers that trick the reward model and get very high scores for nonsensical responses, in a sort of gamification.&lt;/p&gt;

&lt;p&gt;In other words, the reward function is gameable, and LLMs are very good at that game, discovering inputs that are evaluated as excellent, even if they are nonsensical for real humans.&lt;/p&gt;

&lt;p&gt;So RLHF works, but in a limited way. You cannot run it for too long.&lt;br&gt;&lt;br&gt;
The solution is to stop RLHF before the model deteriorates.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;54. What are adversarial examples in RLHF?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;They are nonsensical responses that the LLM learns to generate because they trick the reward model into giving them very high scores.&lt;/p&gt;

&lt;p&gt;The model exploits flaws in the reward model to maximize its score rather than actual quality.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;55. What is the main difference between RL in a verifiable domain and RLHF in an unverifiable domain?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You can run RL for extended periods in a verifiable domain and still discover better solutions.&lt;br&gt;&lt;br&gt;
The game of Go is a good example in which RL applies well. DeepMind trained a model so well that it eventually beat the best Go player.&lt;/p&gt;

&lt;p&gt;RLHF is not the kind of RL that you can run for extended periods. At a certain point, the model starts generating bad responses that are scored highly by the reward model (a problem known as reward model overoptimization).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;56. What does Andrej mean by the "Swiss cheese model"?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Andrej uses the Swiss cheese metaphor to describe LLM capabilities.&lt;br&gt;&lt;/p&gt;

&lt;p&gt;They work really well for certain things, but they fail in other cases, and they do so almost at random, like the holes in Swiss cheese.&lt;/p&gt;

&lt;p&gt;An example of a shortcoming that happened with early models of ChatGPT is:&lt;br&gt;&lt;br&gt;
"What is bigger, 9.11 or 9.9?"&lt;/p&gt;

&lt;p&gt;ChatGPT used to answer "9.11", which is of course wrong.&lt;/p&gt;

&lt;p&gt;Recent models have fixed this problem.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;57. Should you fully trust LLM responses?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;No, you should not. Models are not infallible. They can hallucinate and fail in different ways (see the Swiss cheese model), but they are still powerful and useful tools.&lt;/p&gt;

&lt;p&gt;Use them for a first draft, for inspiration, to summarize, and for many other tasks, but do not fully trust them.&lt;br&gt;&lt;br&gt;
Be responsible for the work you create using LLMs.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;58. What is a multimodal model?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It is a model that can process not only text, but also audio, images, and video.&lt;br&gt;&lt;br&gt;
Those different media can be tokenized in a similar way to text, so multimodal models are not technically very different from text-only LLMs.&lt;br&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;59. What are LLM agents?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Agents are systems built around LLMs that use tools to perform tasks and report progress to humans.&lt;/p&gt;

&lt;p&gt;They can run for minutes or hours to complete longer jobs. Since models are not infallible, they benefit from human supervision, especially for critical tasks.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;60. What is the biggest limitation of LLMs regarding learning?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The capacity to learn new things.&lt;/p&gt;

&lt;p&gt;LLMs ingest all their knowledge during the pre-training and post-training stages. After that, the models do not have the capacity to change their parameters, which means they cannot learn new things.&lt;/p&gt;

&lt;p&gt;You can use in-context learning and give the model examples in the prompt (aka few-shot prompting), but this is not real learning since the parameters do not change.&lt;br&gt;&lt;/p&gt;

&lt;p&gt;Also, the context window is a finite and precious resource, especially when running multimodal tasks, so its use is limited.&lt;/p&gt;

&lt;p&gt;This is an open issue, and there is currently a lot of research to address it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;61. What is LMArena?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://lmarena.ai/" rel="noopener noreferrer"&gt;LMArena&lt;/a&gt; (also known as Chatbot Arena) is an LLM leaderboard that ranks top models based on human comparisons.&lt;br&gt;&lt;br&gt;
Two models are shown the same prompt, and humans compare their responses without knowing which model produced which answer.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;62. In what way is the model DeepSeek-R1 different from Gemini or ChatGPT?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;DeepSeek-R1 has an MIT license and an open-weights release, so anyone can download and use it and freely host their own version of DeepSeek.&lt;br&gt;&lt;br&gt;
On the contrary, Gemini, ChatGPT (or Claude) have proprietary licenses.&lt;/p&gt;

&lt;p&gt;It was surprising that a model as powerful as DeepSeek-R1 was released with open weights. Hopefully, more companies will follow DeepSeek's example.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;63. What is LM Studio?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://lmstudio.ai/" rel="noopener noreferrer"&gt;LM Studio&lt;/a&gt; is an application to run LLMs on your computer.&lt;/p&gt;

&lt;p&gt;You probably cannot run top models locally, like DeepSeek-V3 with 671B parameters (you'd need hundreds of gigabytes of RAM and powerful GPUs), but fortunately there are smaller versions available, such as distilled or quantized models.&lt;br&gt;&lt;br&gt;
You can run these smaller models on a powerful MacBook Pro or Linux box (64–128 GB RAM). To run models more easily, you can use lower precision (quantization).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;LLMs are formidable tools, and the time you spend learning how to leverage them is totally worth it.&lt;/p&gt;

&lt;p&gt;I created these Q&amp;amp;As as personal notes, but I hope you found them inspiring and helpful.&lt;/p&gt;

&lt;p&gt;If you tried to answer the questions before revealing the answers, congratulations! You've just strengthened the neuron connections about LLMs in your brain! (Yes, that's actually how learning works!)&lt;/p&gt;

</description>
      <category>llm</category>
      <category>machinelearning</category>
      <category>tutorial</category>
      <category>learning</category>
    </item>
    <item>
      <title>Why I stopped studying for the AWS Certification</title>
      <dc:creator>Alessandro De Simone</dc:creator>
      <pubDate>Sat, 26 Jul 2025 08:37:39 +0000</pubDate>
      <link>https://dev.to/alexdesi/why-i-stopped-studying-for-the-aws-certification-2h30</link>
      <guid>https://dev.to/alexdesi/why-i-stopped-studying-for-the-aws-certification-2h30</guid>
      <description>&lt;p&gt;I was falling into the same trap again.&lt;/p&gt;

&lt;p&gt;So I wrote this as a reminder to myself and to anyone considering a certification just for the sake of being "certified".&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I started the AWS Certification
&lt;/h2&gt;

&lt;p&gt;I had started studying for the AWS Developer Associate certification.&lt;/p&gt;

&lt;p&gt;As a backend engineer, I often work with AWS services, so improving my AWS skills made sense. It seemed like a smart career move—and a nice addition to my CV.&lt;/p&gt;

&lt;p&gt;With good intentions, I bought a couple of courses and mock exams on Udemy. I was ready to commit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I stopped pursuing it
&lt;/h2&gt;

&lt;p&gt;After a few weeks of studying, it hit me: many of the services required for the certification were irrelevant to my actual work.&lt;/p&gt;

&lt;p&gt;Take AWS CloudFormation, for example. It's their proprietary Infrastructure as Code (IaC) tool, and it's mandatory for the exam.&lt;br&gt;
But I had no real interest in it.&lt;/p&gt;

&lt;p&gt;Why? Because most companies I've worked with, like the Legal Aid Agency (LAA), where I'm currently contracting, use Terraform (an open-source IaC tool). That's what I actually need to know. Not CloudFormation.&lt;/p&gt;

&lt;p&gt;The same logic applied to other services:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;CloudWatch&lt;/strong&gt; is AWS's monitoring tool, but I'm more interested in &lt;strong&gt;Prometheus&lt;/strong&gt; and &lt;strong&gt;Grafana&lt;/strong&gt;, which are more widely adopted in modern DevOps stacks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CodePipeline&lt;/strong&gt; and &lt;strong&gt;CodeBuild&lt;/strong&gt; are AWS's CI/CD tools, but most teams I work with use &lt;strong&gt;GitHub Actions&lt;/strong&gt; or &lt;strong&gt;CircleCI&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I realized I was spending time and energy learning tools I might never use—just to pass an exam.&lt;/p&gt;

&lt;h2&gt;
  
  
  My GCP Certification Experience
&lt;/h2&gt;

&lt;p&gt;This wasn't the first time.&lt;/p&gt;

&lt;p&gt;A few years ago, I spent months preparing for the &lt;strong&gt;Google Cloud Professional Data Engineer&lt;/strong&gt; certification.&lt;br&gt;
I learned about BigQuery, BigTable, and several other Big Data tools.&lt;/p&gt;

&lt;p&gt;It was tough. I had zero experience with Big Data, and I failed the exam twice before finally passing.&lt;/p&gt;

&lt;p&gt;And you know what? I've never used that knowledge in a real project.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Matters More Than Certification
&lt;/h2&gt;

&lt;p&gt;That experience should have taught me something: &lt;strong&gt;learning should be driven by what you actually use and not what a test requires.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Certifications can be valuable if they are strictly required by the company you want to work for (Hey, do you really want to work for them?).&lt;/p&gt;

&lt;p&gt;So I decided to abandon the AWS cert. If I need to learn a specific AWS service for work, I'll learn it—with the goal of applying it immediately.&lt;/p&gt;

&lt;p&gt;Time is limited. Focus on learning what makes you better at your job.&lt;/p&gt;

&lt;p&gt;Luckily, most companies these days — aside from a few exceptions — care more about real skills than just having a certificate.&lt;/p&gt;

&lt;p&gt;And that's great!&lt;/p&gt;

&lt;p&gt;It means you get to decide what's worth learning to grow as a developer.&lt;/p&gt;

</description>
      <category>career</category>
      <category>aws</category>
      <category>beginners</category>
      <category>discuss</category>
    </item>
    <item>
      <title>The Art of Reinventing the wheel in Software Development</title>
      <dc:creator>Alessandro De Simone</dc:creator>
      <pubDate>Tue, 25 Feb 2025 21:08:21 +0000</pubDate>
      <link>https://dev.to/alexdesi/the-art-of-reinventing-the-wheel-in-software-development-307f</link>
      <guid>https://dev.to/alexdesi/the-art-of-reinventing-the-wheel-in-software-development-307f</guid>
      <description>&lt;p&gt;Who said that you should not reinvent the wheel?&lt;/p&gt;

&lt;p&gt;I wrote my website &lt;a href="https://alessandro.desi" rel="noopener noreferrer"&gt;alessandro.desi&lt;/a&gt; from scratch using Python and the Flask framework.&lt;/p&gt;

&lt;p&gt;I actually tried WordPress for a while, but I was not happy with it. Too big and complex. I wanted something simple, and customize on my needs.&lt;/p&gt;

&lt;p&gt;I am sure I could have found a simpler alternative, but I didn’t want to learn another blog system.&lt;/p&gt;

&lt;p&gt;I was pretty good with Ruby and Ruby on Rails, but I wanted to learn Python to widen my job opportunities.&lt;/p&gt;

&lt;p&gt;So I took it as a chance to learn a new language and framework. This website was my first project coded with Python/Flask.&lt;/p&gt;

&lt;p&gt;My experience with Ruby helped, but still, it took days of my free time to build it. It was much slower than expected, but I was keen, and I knew that practicing Python is a valuable skill.&lt;/p&gt;

&lt;p&gt;Python/Flask was not the only thing I practiced:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I wrote the pages in HTML and styled it with CSS.&lt;/li&gt;
&lt;li&gt;I recently added a subscription form to the website to start creating an email list. So I learned about the &lt;em&gt;Flask-SQLAlchemy&lt;/em&gt; package to save the data in a &lt;em&gt;SQLite&lt;/em&gt; database and &lt;em&gt;Flask-WTF&lt;/em&gt; to handle the HTML form and field validations.&lt;/li&gt;
&lt;li&gt;I also set up a VPS (Virtual Private Server) with Linux, installed a web server, and deployed the project.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When you decide to reinvent the wheel, there are so many overlooked details that you need to figure out.&lt;/p&gt;

&lt;p&gt;All of this probably took 30 times longer than just installing WordPress.&lt;/p&gt;

&lt;p&gt;Was it worth it?&lt;/p&gt;

&lt;p&gt;Yes, for me, it was.&lt;br&gt;
My work is coding, and I wanted to expand my skills while building something I needed.&lt;/p&gt;

&lt;p&gt;Should I always use this approach?&lt;br&gt;
Of course not!&lt;/p&gt;

&lt;p&gt;There are many reasons to reuse existing standard and popular wheels:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Allows you to work smoothly as part of a team. Front-end programmers often use React, Angular, or Vue, and it’s easy to find a new developer who knows those JavaScript frameworks.&lt;/li&gt;
&lt;li&gt;Allows you to focus on the value proposition of your project rather than rebuilding basic functionalities.&lt;/li&gt;
&lt;li&gt;Allows you to rely on a wide community that has extensively tested the project and can help resolve issues quickly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In short, most of the time, you should go with the safest choice: rely on an established solution!&lt;/p&gt;

&lt;p&gt;Anyway, I am always amazed by the stories of unconventional coders (and not only), people who are not happy with the status quo.&lt;/p&gt;

&lt;p&gt;Many of the most influential tools we use today exist because someone reinvented a widely used solutions.&lt;br&gt;
Here are some of my favorite examples of rethought projects:&lt;/p&gt;

&lt;h2&gt;
  
  
  Ruby on Rails - Reinventing the Web Framework
&lt;/h2&gt;

&lt;p&gt;Rails is the web framework that allowed me to build my career in the UK when it was the first choice for startups.&lt;br&gt;
Many frameworks existed before Ruby on Rails. But David Heinemeier Hansson (aka DHH) decided to create his own framework while building Basecamp, focusing on developer happiness and convention over configuration. This "reinvention" revolutionized web development and influenced countless frameworks that came after.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hanami - (Re)Reinventing the Web Framework
&lt;/h2&gt;

&lt;p&gt;DHH released Rails in 2004, and after a few years, Rails became the dominant web framework.&lt;br&gt;
But despite that, Luca Guidi saw an opportunity for a different approach. He wanted to create a framework that better followed Object-Oriented Programming (OOP) practices and provided better separation of concerns.&lt;br&gt;
So, in 2014, Luca began developing Hanami (originally called Lotus).&lt;br&gt;
Hanami introduced a modular approach where each part of the application could be a separate micro-application.&lt;br&gt;
This wasn’t just different for the sake of being different—it was an architectural choice aimed at making applications easier to test and maintain over time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Redis - (Re)Inventing the Key-Value Storage
&lt;/h2&gt;

&lt;p&gt;In 2009, Salvatore Sanfilippo was working on a real-time web analytics system for his startup. He needed a way to collect and analyze web page view data as it happened, but the existing databases were too slow. Also, the existing key-value stores didn’t provide the data structures he needed for analytics calculations.&lt;/p&gt;

&lt;p&gt;In this case, Salvatore wasn’t just reinventing the wheel—he was optimizing and evolving it for a specific use case.&lt;/p&gt;

&lt;p&gt;Sanfilippo decided to create something new that would perfectly fit his use case. He wanted a database that could handle high-speed operations in memory, support rich data structures beyond simple key-value pairs, and maintain data persistence when needed.&lt;/p&gt;

&lt;p&gt;This led to the birth of Redis (REmote DIctionary Server).&lt;br&gt;
Today, Redis is used by countless companies. It is used in most of the companies I’ve worked at, even at the Ministry of Justice (UK), where I am working now.&lt;/p&gt;




&lt;p&gt;I am sure you noticed I am totally biased with my stories. The first concerns Rails, which I’ve used for many years. Hanami and Redis were created by Italian programmers. :)&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Even though the projects I mentioned are monstrously complex, you can start by recreating simpler things.&lt;/p&gt;

&lt;p&gt;Here are some ideas for programmers who want to understand how things work under the hood:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Implement a few algorithms. Developers don’t need to write sorting, search, or graph algorithms anymore, but they are exciting to code! Start easy, choose a sorting algorithm like Bubble Sort or Quick Sort, for example. Then continue with more complex ones, like Shortest Path in a Graph (Dijkstra’s).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create your version of Tetris, Pac-Man, or any simple platform game to practice the language you are learning. It is amazing how many useful concepts you can learn by creating simple games.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Build your own &lt;a href="https://www.youtube.com/watch?v=Hncp0mPfUvk" rel="noopener noreferrer"&gt;web server from scratch&lt;/a&gt;. You’ll learn networking concepts like sockets, HTTP, and TCP.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Build an elastic collision engine or any physics simulation. A few years ago, while learning Golang, I wrote a &lt;a href="https://github.com/alexdesi/collisions" rel="noopener noreferrer"&gt;two sphere collision simulator&lt;/a&gt; in Golang. It was fun and educational.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Build a simple 3D wireframe engine. This is great for refreshing your knowledge of matrix algebra.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Build a simple neural network from scratch. This is something I’d like to try. First, understand well what a neural network is, and then approach the code with a good tutorial. Just google "Neural Network from scratch Python."&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Happy re-invention! And thanks for reading.&lt;/p&gt;

</description>
      <category>learning</category>
      <category>python</category>
      <category>ruby</category>
      <category>programming</category>
    </item>
    <item>
      <title>What's in your SW Developer toolbox?</title>
      <dc:creator>Alessandro De Simone</dc:creator>
      <pubDate>Sat, 16 Jul 2022 20:53:32 +0000</pubDate>
      <link>https://dev.to/alexdesi/whats-in-your-sw-developer-toolbox-dbd</link>
      <guid>https://dev.to/alexdesi/whats-in-your-sw-developer-toolbox-dbd</guid>
      <description>&lt;p&gt;Let's assume you know a programming language and are proficient with it. &lt;/p&gt;

&lt;p&gt;Is it enough to be a professional SW developer?&lt;/p&gt;

&lt;p&gt;No, it is not.&lt;br&gt;&lt;br&gt;
The programming language is your primary tool. It is the brush of the painter and the hammer of the carpenter.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4znd6e43af9z8p1smalv.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4znd6e43af9z8p1smalv.jpg" alt="Image description" width="800" height="533"&gt;&lt;/a&gt;&lt;br&gt;
But you'd need to master other tools to collaborate with other developers and contribute to complex applications.&lt;/p&gt;

&lt;p&gt;In Italy, there is a saying which goes like this:&lt;br&gt;
"I ferri fanno il mastro"&lt;br&gt;
which means "the tools make the master craftsman".&lt;/p&gt;

&lt;p&gt;If you take it literally, it is not very accurate. You also need the experience to use the tools.&lt;/p&gt;

&lt;p&gt;In this context,  "having the tool" means being able to recognise when it's good to use a specific technology and to be able to solve the problem using it.&lt;/p&gt;

&lt;p&gt;What should be in the toolbox of a developer?&lt;br&gt;
It depends. Web developers, mobile developers, and data engineers (and so on) use different tools.&lt;br&gt;
For example, knowing about ELT process might not matter for a Web developer, but it's crucial for a data engineer. On the other hand, Html and CSS are essential for a web developer.&lt;/p&gt;

&lt;p&gt;If you are a Ruby developer, at the very core, you must know:&lt;br&gt;
Ruby on Rails, RSpec, a Ruby version manager (RVM, asdf, ...)&lt;br&gt;
and to fill a senior position, be sure to put a bunch of gems, a good knowledge of OOP, and SQL in your toolbox.&lt;/p&gt;

&lt;p&gt;There is no limit on the tools you can have, but it requires time to acquire them, and that's your limit.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Choose carefully the tools you want to put in your toolbox based on the career you want.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I've spent many months studying Data and ML to get the GCP Data Engineering professional certification.&lt;/p&gt;

&lt;p&gt;After a while, I realised that it was irrelevant to my career. I had a vague idea of moving toward a career in data engineering, but my approach was wrong.&lt;br&gt;&lt;br&gt;
A better way would have been to learn Python and ML libraries and start an actual project using them.&lt;/p&gt;

&lt;p&gt;The GCP Data certification does not add much to my employability. It's just not required for a Ruby Engineer.&lt;br&gt;
What's in high demand - for my profile like mine - are DevOps and CI/CD skills, for example.&lt;/p&gt;

&lt;p&gt;After a few errors, I've developed a few ways to choose a new subject to learn.  These are:&lt;/p&gt;

&lt;h2&gt;
  
  
  Notice what slows you down in your daily job
&lt;/h2&gt;

&lt;p&gt;Sometimes, you are already using a tool, but your knowledge is shallow, and you spend lots of time on Stack Overflow to find responses, which you'll forget in a few days.&lt;br&gt;
It might be Git or SQL, for example. Find the time to master the tools that you use often.&lt;/p&gt;

&lt;h2&gt;
  
  
  Analyse the typical job specs
&lt;/h2&gt;

&lt;p&gt;Visit an online job board, and insert your job description in the search box.&lt;br&gt;
Then, open the results relevant to the position you are interested in.&lt;/p&gt;

&lt;p&gt;Your goal is to find the IT skills that are most present in the various job spec (or, in other words, the keywords with the highest frequency).&lt;/p&gt;

&lt;p&gt;Those are the skills that you should consider learning&lt;/p&gt;

&lt;h2&gt;
  
  
  Website showing the co-occurring IT Skills
&lt;/h2&gt;

&lt;p&gt;Similarly, some websites allow you to find skills related to a particular skill.&lt;/p&gt;

&lt;p&gt;The website &lt;em&gt;ItJobsWatch&lt;/em&gt; calls them "Co-occurring IT Skills", and it finds them processing thousands of job specs. &lt;/p&gt;

&lt;p&gt;It is similar to the previous method but applied at scale.&lt;/p&gt;

&lt;p&gt;For example, the following link shows skills most related to Ruby On Rails:&lt;br&gt;
&lt;a href="https://www.itjobswatch.co.uk/jobs/uk/ruby%20on%20rails.do#related_skills" rel="noopener noreferrer"&gt;Ruby on Rails - Related skills&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and they are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Javascript&lt;/li&gt;
&lt;li&gt;Docker&lt;/li&gt;
&lt;li&gt;Git&lt;/li&gt;
&lt;li&gt;SQL&lt;/li&gt;
&lt;li&gt;React&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Those are indeed the most required skills for a Ruby On Rails developer.&lt;/p&gt;

&lt;p&gt;(Surprising, the list also shows Java, which is not correct, in my opinion)&lt;/p&gt;

&lt;h2&gt;
  
  
  Find out common skills
&lt;/h2&gt;

&lt;p&gt;The last technique is analysing a broader set of job descriptions and discovering what are the skills in common.&lt;/p&gt;

&lt;p&gt;For example, if you search for "Back End Developer", regardless of the programming language, you'll find the following skills (among others):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;OOP (Object Oriented Programming)&lt;/li&gt;
&lt;li&gt;Testing&lt;/li&gt;
&lt;li&gt;Docker&lt;/li&gt;
&lt;li&gt;Git&lt;/li&gt;
&lt;li&gt;SQL&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Those skills are fundamental because they will remain relevant in your career, even if you switch to a different programming language.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>tutorial</category>
      <category>productivity</category>
    </item>
    <item>
      <title>How to make peace with Ruby on Rails and code happily</title>
      <dc:creator>Alessandro De Simone</dc:creator>
      <pubDate>Sun, 04 Jul 2021 11:57:19 +0000</pubDate>
      <link>https://dev.to/alexdesi/how-to-clean-up-messy-ruby-on-rails-applications-386f</link>
      <guid>https://dev.to/alexdesi/how-to-clean-up-messy-ruby-on-rails-applications-386f</guid>
      <description>&lt;p&gt;This post sums up few ideas from various articles and videos which helped me to realize why most of the big Ruby on Rails applications are hard to maintain.&lt;/p&gt;

&lt;p&gt;I've been working on small Ruby on Rails apps, gigantic monoliths and tangled microservices for about 10 years. &lt;/p&gt;

&lt;p&gt;Ruby on Rails takes full advantage of the flexibility of the Ruby language.&lt;/p&gt;

&lt;p&gt;Matz (Yukihiro Matsumoto) built the language to make life easy for developers, and even make them happy.&lt;/p&gt;

&lt;p&gt;In fact, Ruby's motto is &lt;em&gt;A Programmer's Best Friend&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;I code in Ruby every day, and I have to admit, I rarely feel "happiness".&lt;/p&gt;

&lt;p&gt;Sometimes I am pleased with my solution, but most of the time I strive to gain an understanding of what the code is doing.&lt;/p&gt;

&lt;p&gt;Why does it happen?&lt;/p&gt;

&lt;p&gt;Shouldn't I feel joy while coding in a perfect status of flow?&lt;/p&gt;

&lt;p&gt;Let's start with a basic principle: &lt;/p&gt;

&lt;p&gt;to add or change functionalities to an application, developers needs to understand its code.&lt;/p&gt;

&lt;p&gt;Readable code is easy to understand and easy to change. &lt;/p&gt;

&lt;p&gt;Code is read many more times than it is written, so investing time to write readable code pays off, even in the short term. The less &lt;a href="https://alessandro.desi/code-smells" rel="noopener noreferrer"&gt;bad code smells&lt;/a&gt; in the code, the better.&lt;/p&gt;

&lt;p&gt;There are many books about writing good code, two good ones are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Practical Object-Oriented Design, by Sandi Metz.&lt;br&gt;&lt;br&gt;
This is my favourite book about writing maintainable Object-Oriented applications in Ruby.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Refactoring: Ruby Edition, by Jay Fields, Martin Fowler, and Shane Harvie.&lt;br&gt;&lt;br&gt;
This is the Ruby version of the most famous book about &lt;a href="https://alessandro.desi/code-smells" rel="noopener noreferrer"&gt;bad code smells&lt;/a&gt; and how to refactor them.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The issues present in most of the Rails apps I've worked with are linked to the topics of the two books: poor &lt;em&gt;OOP&lt;/em&gt; and &lt;em&gt;Bad Smell in code&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;These are the most common issues I've seen in many Rails  apps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fat model&lt;/li&gt;
&lt;li&gt;Fat controller&lt;/li&gt;
&lt;li&gt;Logic in the view&lt;/li&gt;
&lt;li&gt;Lack of a clear design&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Fat Model
&lt;/h2&gt;

&lt;p&gt;The responsibility of a model is to persist data in a DB table and manage associations with other models.&lt;/p&gt;

&lt;p&gt;It is very easy to add functionalities to them, and common to see models named &lt;code&gt;User&lt;/code&gt;, &lt;code&gt;Company&lt;/code&gt; or &lt;code&gt;Booking&lt;/code&gt; having tens of methods and many hundreds of lines.&lt;/p&gt;

&lt;p&gt;Inside those fat models, you can find logic about validations, policies, business and views.&lt;/p&gt;

&lt;p&gt;Also, they are often soiled with many callbacks which turns the model into a bowl of spaghetti code.&lt;/p&gt;

&lt;p&gt;There are few patterns you can follow to keep models clean. Here is a helpful post that describes &lt;a href="https://codeclimate.com/blog/7-ways-to-decompose-fat-activerecord-models/" rel="noopener noreferrer"&gt;7 Patterns to Refactor Fat ActiveRecord Models&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Fat Controller
&lt;/h2&gt;

&lt;p&gt;Fat controllers are even worse than fat models.&lt;br&gt;&lt;br&gt;
The controller is the home of the actions linked to the HTTP calls. &lt;/p&gt;

&lt;p&gt;The only duty of a controller action should be "to call an action" and render the result (or redirect to a different page).&lt;/p&gt;

&lt;p&gt;Often the controller actions contain logic about:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;business rules&lt;/li&gt;
&lt;li&gt;database access&lt;/li&gt;
&lt;li&gt;presentation logic&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When that happens, it makes the actions long, confusing and hard to maintain. Also the tests would be long and messy.&lt;/p&gt;

&lt;p&gt;Moving all the business logic to a Service object is a step forward.&lt;br&gt;&lt;br&gt;
The controller action will call the service and then render/redirect with the proper HTTP status based on the service result.&lt;/p&gt;

&lt;p&gt;Beware of misusing Service Objects as they do not provide a good abstraction for your Business Domain, they just procedure.&lt;/p&gt;

&lt;p&gt;Jason Swett summarised well why using Service Object should not be the rule in &lt;a href="https://www.codewithjason.com/rails-service-objects/" rel="noopener noreferrer"&gt;Beware of service objects in Rails&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Avdi Grimm suggests that it is fine to write procedure instead of services, especially when the domain concepts are not yet well defined.&lt;br&gt;&lt;br&gt;
He wrote about this in &lt;a href="https://avdi.codes/service-objects/" rel="noopener noreferrer"&gt;Enough With the Service Objects Already&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Logic in the view
&lt;/h2&gt;

&lt;p&gt;The view should contain as little logic as possible.&lt;/p&gt;

&lt;p&gt;Mixing up Ruby code with HTML code makes the views unreadable and hard to test.&lt;/p&gt;

&lt;p&gt;Messy Rails views often contain one or more of the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Nested conditionals&lt;/li&gt;
&lt;li&gt;Calculations&lt;/li&gt;
&lt;li&gt;DB queries&lt;/li&gt;
&lt;li&gt;Variable assignments&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thus, you need to keep those outside the views.&lt;br&gt;&lt;br&gt;
Two common techniques to help you to keep the views clean are Decorators and the View objects.&lt;/p&gt;

&lt;p&gt;Here is an article explaining what they are and why moving the logic to the models is not a solution: &lt;a href="https://jtway.co/cleaning-up-your-rails-views-with-view-objects-42cf048ea491" rel="noopener noreferrer"&gt;Cleaning Up Your Rails Views With View Objects&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Lack of a clear design
&lt;/h2&gt;

&lt;p&gt;This is the result of the previous three subjects.&lt;br&gt;&lt;br&gt;
If the business logic pervades the models, controllers and even views, you'll have a hard time understanding what is the business domain of the application. The design is abstract and entangled with the concepts of Ruby on Rails, and business concepts are mixed with those of the framework.&lt;/p&gt;

&lt;p&gt;A possible solution is to start up front to adopt design patterns like Clean Architecture or Exagonal Architecture.&lt;/p&gt;

&lt;p&gt;Those patterns are not convenient for small Rails apps, but they pay off for big projects.&lt;/p&gt;

&lt;p&gt;However, note that if the application eventually succeeds, it will grow and more functionalities will be added by you and your workmates, and if it lacks a clear design, you will have a hard time maintaining it.&lt;/p&gt;

&lt;p&gt;At the GoRuCo 2012 conference, Matt Wynne gave a great talk about &lt;a href="https://www.youtube.com/watch?v=CGN4RFkhH2M" rel="noopener noreferrer"&gt;Hexagonal Rails&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Ruby is a flexible and powerful language and it should be a pleasure coding with it.&lt;/p&gt;

&lt;p&gt;Often big messy Rails applications (and not just Rails) make your life as a developer really hard.&lt;/p&gt;

&lt;p&gt;That should not be the norm, there are various strategies that you can follow to keep your project readable and maintainable, and in fact, there are many successful start-ups based on Rails applications beautifully coded.&lt;/p&gt;

&lt;p&gt;I hope you've found this post and its links helpful.&lt;/p&gt;




&lt;p&gt;This was initially published on my blog here: &lt;a href="https://alessandro.desi/clean-rails" rel="noopener noreferrer"&gt;How to make peace with Ruby on Rails and code happily&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ruby</category>
      <category>rails</category>
    </item>
  </channel>
</rss>
