{"@attributes":{"version":"2.0"},"channel":{"title":"About me","link":"https:\/\/steffenhaeussler.github.io\/","description":"Recent content on About me","generator":"Hugo","language":"en-US","lastBuildDate":"Sun, 12 Jul 2026 10:20:58 +0100","item":[{"title":"Engineering with AI agents II","link":"https:\/\/steffenhaeussler.github.io\/posts\/2026-06-28-engineering_ai_2\/engineering\/","pubDate":"Sun, 12 Jul 2026 10:20:58 +0100","guid":"https:\/\/steffenhaeussler.github.io\/posts\/2026-06-28-engineering_ai_2\/engineering\/","description":"<p>Hi,<\/p>\n<p><a href=\"https:\/\/steffenhaeussler.github.io\/posts\/2026-06-14-engineering_ai\/engineering\/\">Four weeks ago<\/a>, I looked into <a href=\"https:\/\/temporal.io\/\">Temporal.io<\/a> as a platform for building and orchestration reliable workflows. I looked at it through the lens of distributed systems, combining it with concepts from <a href=\"https:\/\/www.oreilly.com\/library\/view\/designing-data-intensive-applications\/9781491903063\/\">Martin Kleppmann\u2019s Designing Data-Intensive Applications (for reference, DDIA)<\/a>. In this post, I team up with Claude Code and Codex to rebuild these core architectural ideas using <a href=\"https:\/\/www.langchain.com\/langgraph\">LangGraph<\/a> and <a href=\"https:\/\/www.postgresql.org\/\">Postgres<\/a>. LangGraph is built specifically for stateful, multi-agent systems. My goal here is to dig deeper into orchestration patterns and gain a clearer understanding of what it takes to run agentic systems in production. My long-term goal is exploring the fault-tolerant guarantees of Temporal with the agentic flexibility of LangGraph as a combination for modern enterprise workflows.<\/p>"},{"title":"Engineering with AI agents","link":"https:\/\/steffenhaeussler.github.io\/posts\/2026-06-14-engineering_ai\/engineering\/","pubDate":"Sat, 13 Jun 2026 10:20:58 +0100","guid":"https:\/\/steffenhaeussler.github.io\/posts\/2026-06-14-engineering_ai\/engineering\/","description":"<p>Hi,<\/p>\n<p>For more than a year, I have been using coding agents, mostly Claude Code. During that time, I have barely written code myself. Instead, my role has shifted toward planning, reviewing and understanding code. I also use these agents for studying, brainstorming and problem-solving. I definitely struggle with the blurred boundary of my own work and orchestrated LLM work. I feel like a Code DJ by using and mixing ideas and samples from someone else.<\/p>"},{"title":"Overview of Agentic AI","link":"https:\/\/steffenhaeussler.github.io\/posts\/2026-06-01-overview_agents-\/agents\/","pubDate":"Mon, 01 Jun 2026 10:30:58 +0100","guid":"https:\/\/steffenhaeussler.github.io\/posts\/2026-06-01-overview_agents-\/agents\/","description":"<p>Hi,<\/p>\n<p>In this post I want to outline Agentic AI. I&rsquo;ve spent the last two years building AI agents and I want to share an overview of what I&rsquo;ve learned. I originally meant to start this series a year ago, but finding the time was tough. While this field is moving incredibly fast, I\u2019m going to ignore the latest hype and focus strictly on the fundamentals.<\/p>\n<p>Nowadays, the term &ldquo;agent&rdquo; is used loosely for almost any system involving an LLM. As an introduction, I want to draw a clear distinction between an agent and a workflow. An agent operates in an open environment and autonomously figures out how to solve a problem (e.g. a chatbot for data analysis). In contrast, a workflow is a predefined sequence of steps in which an LLM is used to execute specific tasks (e.g. extracting text to fill out a form).<\/p>"},{"title":"Agentic Design Patterns","link":"https:\/\/steffenhaeussler.github.io\/posts\/2026-05-05-agentic-design-patterns\/agentic_patterns\/","pubDate":"Tue, 05 May 2026 10:30:58 +0100","guid":"https:\/\/steffenhaeussler.github.io\/posts\/2026-05-05-agentic-design-patterns\/agentic_patterns\/","description":"<p>Hi,<\/p>\n<p>This post is written by AI as an experiment. I put much effort into guidelines and specified several rounds of improvements, but the result is still not very graspable. It&rsquo;s not bad, but also not really good.<\/p>\n<p>I see this as a proxy for the current state of agentic coding. Everyone uses it, but if you look at the outcome it is often shallow. If you mention your concerns about quality, responsibility and ownership, you will be always ignored because of the productivity gain.<\/p>"},{"title":"Fine-tuning the generative part of a RAG","link":"https:\/\/steffenhaeussler.github.io\/posts\/2026-04-01-generative\/gen_llm\/","pubDate":"Wed, 01 Apr 2026 10:30:58 +0100","guid":"https:\/\/steffenhaeussler.github.io\/posts\/2026-04-01-generative\/gen_llm\/","description":"<p>Hi,<\/p>\n<p>this is the final post in my series about RAG systems. Here I will look into fine-tuning the generative part of a RAG system. Here is the <a href=\"https:\/\/www.kaggle.com\/code\/steffenhaeussler\/fine-tuning-a-llm\">notebook<\/a>. But mostly this is for me a method to understand LLM fine-tuning in a superficial and general way.<\/p>\n<p>For the records, I looked into <a href=\"https:\/\/www.kaggle.com\/code\/steffenhaeussler\/examples-for-information-retrieval\">search<\/a>, <a href=\"https:\/\/www.kaggle.com\/code\/steffenhaeussler\/understanding-approx-nearest-neighbor-algorithm\">ANN Algorithms<\/a>, <a href=\"https:\/\/steffenhaeussler.github.io\/posts\/2026-01-09-contrastive\/contrastive\/\">fine-tuning embedding models<\/a>, <a href=\"https:\/\/www.kaggle.com\/code\/steffenhaeussler\/fine-tuning-a-reranker\">fine-tuning a reranker<\/a> and <a href=\"https:\/\/www.kaggle.com\/code\/steffenhaeussler\/evaluation-of-rag-systems\">evaluation of RAG systems<\/a> in my previous posts.<\/p>\n<p>In RAG, the retrieval step provides the facts. The fine-tuning is about model behavior to prevent that a base model hallucinate or ignore the provided data. As a rule of thumb, retrieval gives the model its memory and fine-tuning gives it its instructions.<\/p>"},{"title":"Fine-tuning a ReRanker","link":"https:\/\/steffenhaeussler.github.io\/posts\/2026-03-20-reranker\/reranker\/","pubDate":"Fri, 20 Mar 2026 10:30:58 +0100","guid":"https:\/\/steffenhaeussler.github.io\/posts\/2026-03-20-reranker\/reranker\/","description":"<p>Hi,<\/p>\n<p>Based on my <a href=\"https:\/\/steffenhaeussler.github.io\/posts\/2026-01-09-contrastive\/contrastive\/\">previous post<\/a>, I looked into fine-tuning a bi-encoder via self-supervised learning. As a logical next step, I now want to fine-tune a cross-encoder for my specific task. This is not as easy as fine-tuning a bi-encoder, because cross-encoders are not designed to be trained with contrastive learning.<\/p>\n<p>Therefor I looked into four different approaches to fine-tune a cross-encoder for my specific task:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.kaggle.com\/code\/steffenhaeussler\/fine-tuning-a-reranker\">BCE loss<\/a><\/li>\n<li><a href=\"https:\/\/www.kaggle.com\/code\/steffenhaeussler\/fine-tuning-a-reranker-part-2-with-bce-loss\">BCE loss with hard negatives<\/a><\/li>\n<li><a href=\"https:\/\/www.kaggle.com\/code\/steffenhaeussler\/fine-tuning-a-reranker-part-3-with-infonce-loss\">InfoNCE loss<\/a><\/li>\n<li><a href=\"https:\/\/www.kaggle.com\/code\/steffenhaeussler\/fine-tuning-a-reranker-part-4-margin-mse-loss\">Margin MSE loss<\/a><\/li>\n<\/ul>\n<h2 id=\"bce-loss\">BCE loss<\/h2>\n<p>The simplest approach is to use binary cross-entropy loss to train the model. Here we have two labels, 1 for a positive pair and 0 for a negative pair and treat the relevance as a binary classification problem <a href=\"https:\/\/arxiv.org\/pdf\/1901.04085\">Passage Re-Ranking with BERT by Nogueira and Cho 2020<\/a>. This can also be called a pointwise approach. For every query-document pair we calculate the logit, then apply a sigmoid activation twhich will represent the probability of relevance.<\/p>"},{"title":"Training an embedding model","link":"https:\/\/steffenhaeussler.github.io\/posts\/2026-01-09-contrastive\/contrastive\/","pubDate":"Fri, 09 Jan 2026 10:30:58 +0100","guid":"https:\/\/steffenhaeussler.github.io\/posts\/2026-01-09-contrastive\/contrastive\/","description":"<p>Hi,<\/p>\n<p>Based on my <a href=\"https:\/\/steffenhaeussler.github.io\/posts\/2025-01-02-embeddings\/embeddings\/\">previous post<\/a>, I need to write a correction. I was wrong.<\/p>\n<p>I previously suggested using embeddings directly from pre-trained models. That turns out to be a bad idea, because the training objectives are fundamentally different. As an alternative, I have now explored training an embedding model using Contrastive Learning.<\/p>\n<p>Please look at my <a href=\"https:\/\/www.kaggle.com\/code\/steffenhaeussler\/contrastive-learning\">notebook<\/a> for the full code and details.<\/p>\n<p>The main reason you should not use raw embeddings from pre-trained models is the anisotropy problem. The paper <a href=\"https:\/\/arxiv.org\/pdf\/1909.00512\">How Contextual are Contextualized Word Representations? from Ethayarajh et al. 2019<\/a> shows that the embeddings are clustered in a narrow cone of the vector space, making them almost useless for differentiation. So, if you calculate the cosine similarity between two completely different sentences, the result will be around 0.80.<\/p>"},{"title":"This year's recap v2","link":"https:\/\/steffenhaeussler.github.io\/posts\/2025-12-29-recap\/recapv2\/","pubDate":"Mon, 29 Dec 2025 10:30:58 +0100","guid":"https:\/\/steffenhaeussler.github.io\/posts\/2025-12-29-recap\/recapv2\/","description":"<p>Hi,<\/p>\n<p>I decided to add another post to this year&rsquo;s recap. After I described my three key learnings from my failed startup endeavor, I wasn&rsquo;t feeling finished or satisfied. Overall I&rsquo;m not satisfied with what I learned this year. It feels very shallow without any hard skills behind it. In every year of my life, I learned a lot, independent of the later usefulness, but at least I can say, that I moved forward. This year, I don&rsquo;t feel like this. As Confucius said: &ldquo;By three methods we may learn wisdom: First, by reflection, which is noblest; Second, by imitation, which is easiest; and third by experience, which is the bitterest.&rdquo; My learnings weren&rsquo;t helpful at all and they came from experience.\nTo sum it up, the ratio of effort and outcome was very low and I definitely can do better.<\/p>"},{"title":"This year's recap","link":"https:\/\/steffenhaeussler.github.io\/posts\/2025-12-12-recap\/recap\/","pubDate":"Fri, 12 Dec 2025 10:30:58 +0100","guid":"https:\/\/steffenhaeussler.github.io\/posts\/2025-12-12-recap\/recap\/","description":"<p>Hi,<\/p>\n<p>This year was an interesting learning experience. I tried to commercialize a product, which in the end was much harder than expected.\nAs a short summary, the first attempt failed, because I couldn&rsquo;t figure out how to sell the product. The pivot failed, because multiple big corporates released a similar product. Also the goal was to get 1-2 customers to build a MVP before looking for funding and so on. So I never incorporated the idea into a company. Basically, I failed already on the first meter, but this saved a lot of time. So I only invested 7\nmonths. \ud83e\udd72<\/p>"},{"title":"Building Agents & LLM Workflows","link":"https:\/\/steffenhaeussler.github.io\/posts\/2025-07-30-hackerroom\/hackerroom\/","pubDate":"Wed, 30 Jul 2025 10:30:58 +0100","guid":"https:\/\/steffenhaeussler.github.io\/posts\/2025-07-30-hackerroom\/hackerroom\/","description":"<p>Hi,<\/p>\n<p>Over the last three months, I&rsquo;ve been working on Agents and LLM workflows. I had the opportunity to do this as part of a <a href=\"https:\/\/www.merantix-aicampus.com\/hacker-room\">residency program<\/a> at <a href=\"https:\/\/www.merantix-aicampus.com\/\">Merantix<\/a>.\nI&rsquo;m deeply thankful for the opportunity and would highly recommend the program to others. Being surrounded by people with shared goals was incredibly motivating and inspiring.\nI already miss the discussions and the knowledge exchange. Unlike typical work environments, here the participants were truly aligned, and everyone learned from each other.<\/p>"},{"title":"Evaluation of RAG Systems","link":"https:\/\/steffenhaeussler.github.io\/posts\/2025-04-30-metrics\/metrics\/","pubDate":"Wed, 30 Apr 2025 10:30:58 +0100","guid":"https:\/\/steffenhaeussler.github.io\/posts\/2025-04-30-metrics\/metrics\/","description":"<p>Hi,<\/p>\n<p>The implementation of this article is <a href=\"https:\/\/www.kaggle.com\/code\/steffenhaeussler\/evaluation-of-rag-systems\">here<\/a>.<\/p>\n<p>RAGs are complex systems. This is obvious, when you try to evaluate them. There are multiple aspects, which need to be checked. Here, I try to look into different approaches to get a better understanding and problems, when facing RAG systems. RAG system evaluation involves two distinct parts: retrieval and generation part. For retrieval, context relevance and noise robustness are key factors in assessing quality, while for generation part, key factors like answer faithfulness, answer relevance, negative rejection, information integration, and counterfactual robustness are important (<a href=\"https:\/\/arxiv.org\/pdf\/2312.10997#page=14\">Gao et al. 2024<\/a>).<\/p>"},{"title":"Understanding approximate nearest neighbor algorithm","link":"https:\/\/steffenhaeussler.github.io\/posts\/2025-04-19-ann\/ann\/","pubDate":"Sat, 19 Apr 2025 10:30:58 +0100","guid":"https:\/\/steffenhaeussler.github.io\/posts\/2025-04-19-ann\/ann\/","description":"<p>Hi,<\/p>\n<p>This post is about the approximate nearest neighbor (ANN) algorithm. The code for this post is <a href=\"https:\/\/www.kaggle.com\/code\/steffenhaeussler\/understanding-approx-nearest-neighbor-algorithm\">here<\/a>, where I provide an example of using a framework and a python implementation. Most python implementation were written with the help of a LLM. I&rsquo;m amazed, how helpful they are for learning new things. I see them like a drunken professor, which with the right approach will be a very helpful tool.<\/p>\n<p>As a next step in understanding RAGs, I want to have a closer look at approximate nearest neighbor algorithms. Basically, the purpose is to find the closest vector to a query vector in a database. Since I&rsquo;m also interested into the implementation, I follow mostly this amazing blog post. Vector search is the basic component of vector databases and their main purpose. ANN algorithms are looking for a close match instead of an exact match. This loss of accuracy allows an improvement of efficieny, which allows the search through much bigger datasets, high-dimensional data and real-time apllications.<\/p>"},{"title":"Short example of Information Retrieval","link":"https:\/\/steffenhaeussler.github.io\/posts\/2025-03-10-retrieval\/retrieval\/","pubDate":"Mon, 10 Mar 2025 10:30:58 +0100","guid":"https:\/\/steffenhaeussler.github.io\/posts\/2025-03-10-retrieval\/retrieval\/","description":"<p>Hi,<\/p>\n<p>Some time ago, I did a small project on information retrieval. I think, it\\s a good idea to share it with all its shortcomings.\nHere is the <a href=\"https:\/\/www.kaggle.com\/code\/steffenhaeussler\/examples-for-information-retrieval\">code<\/a>. Sadly, the LLM part doesn&rsquo;t work with the quantized model, so I commented it out.\nThe project is a small information retrieval of a FAQ, where I want to map the correct answer to a question. In my example, it&rsquo;s a 1:1 mapping between question and answer, but it also works with multiple answers.<\/p>"},{"title":"Get embeddings for multiple data sources","link":"https:\/\/steffenhaeussler.github.io\/posts\/2025-01-02-embeddings\/embeddings\/","pubDate":"Thu, 02 Jan 2025 10:30:58 +0100","guid":"https:\/\/steffenhaeussler.github.io\/posts\/2025-01-02-embeddings\/embeddings\/","description":"<p>DISCLAIMER: This is wrong. Please ignore this post.<\/p>\n<p>Hi,<\/p>\n<p>Following my first short post about <a href=\"https:\/\/steffenhaeussler.github.io\/posts\/2024-12-27-overview\/rag_overview\/\">RAGs<\/a>, I would like to provide a brief overview about embeddings, which are used to find similiar objects in a vector database. To better understand how various transformer models handle different input data types, I created this <a href=\"https:\/\/www.kaggle.com\/code\/steffenhaeussler\/get-embeddings-for-multiple-data-types\">notebook<\/a>. I explore therefor, text, image, audio and video data.<\/p>\n<p>I\u2019ve chosen to skip the more traditional text embeddings (TF-IDF, Word2Vec or GloVe), because there are already very good tutorials available. Additionally, I plan to discuss the training of embedding models in a separate blog post. For this post, I use mostly pretrained classification models, where I use the last layer before the prediction head as embedding.<\/p>"},{"title":"Overview of RAG (Retrieval-Augmented Generation) systems","link":"https:\/\/steffenhaeussler.github.io\/posts\/2024-12-27-overview\/rag_overview\/","pubDate":"Fri, 27 Dec 2024 10:30:58 +0100","guid":"https:\/\/steffenhaeussler.github.io\/posts\/2024-12-27-overview\/rag_overview\/","description":"<p>Hi,<\/p>\n<p>It\u2019s been a while since my last post, mostly because of my own laziness. Over the past year, I\u2019ve been working on several projects, one of which is a small RAG (Retrieval-Augmented Generation) system. I implemented it to combine external knowledge (in this case internal safety documents) with a large language model (LLM). This approach allows the use of data that the LLM wasn&rsquo;t trained on and also helps reduce hallucinations.<\/p>"},{"title":"Deep Learning model explainability","link":"https:\/\/steffenhaeussler.github.io\/posts\/2023-12-08-dl-explainability\/dl_model_explainability\/","pubDate":"Fri, 08 Dec 2023 10:30:58 +0100","guid":"https:\/\/steffenhaeussler.github.io\/posts\/2023-12-08-dl-explainability\/dl_model_explainability\/","description":"<p>Hi,<\/p>\n<p><a href=\"https:\/\/steffenhaeussler.github.io\/posts\/model_explainability\/\">In my first post<\/a>, I looked into the explainability of classical machine learning models. As a next step, I&rsquo;m interested in the explainability of neural networks.  Model explainability is easy for simple models (linear regression, decision trees), and some tools exist for more complex algorithms (ensemble trees). Therefore, I highly recommend the book <a href=\"https:\/\/christophm.github.io\/interpretable-ml-book\/\">Interpretable Machine Learning by Christoph Molnar<\/a> for a deeper theoretical understanding. All different approaches for model explanability are shown with a PyTorch model <a href=\"https:\/\/www.kaggle.com\/code\/steffenhaeussler\/mohs-hardness-model-explainer-for-neuralnets\/notebook\">in this kaggle notebook<\/a>.<\/p>"},{"title":"Model explainability","link":"https:\/\/steffenhaeussler.github.io\/posts\/2023-11-21-explainability\/model_explainability\/","pubDate":"Tue, 21 Nov 2023 10:30:58 +0100","guid":"https:\/\/steffenhaeussler.github.io\/posts\/2023-11-21-explainability\/model_explainability\/","description":"<p>Hi,<\/p>\n<p>Some months have passed since my last post. Model explainability is easy for simple models (linear regression, decision trees), and some tools exist for more complex algorithms (ensemble trees). I want to dig into the tools to interpret more complex models with this post. Therefore, I highly recommend the book <a href=\"https:\/\/christophm.github.io\/interpretable-ml-book\/\">Interpretable Machine Learning by Christoph Molnar<\/a> for a deeper theoretical understanding. All different approaches for model explanability are shown with a RandomForest model <a href=\"https:\/\/www.kaggle.com\/code\/steffenhaeussler\/mohs-hardness-model-explainer\/notebook\">in this kaggle notebook<\/a>.<\/p>"},{"title":"Implementing a Transformer Network from scratch","link":"https:\/\/steffenhaeussler.github.io\/posts\/2023-08-28-transformer\/transformer\/","pubDate":"Mon, 28 Aug 2023 10:30:58 +0100","guid":"https:\/\/steffenhaeussler.github.io\/posts\/2023-08-28-transformer\/transformer\/","description":"<p>Hi,<\/p>\n<p>This post is about my implementation of an <a href=\"https:\/\/www.kaggle.com\/code\/steffenhaeussler\/dna-sequence-classification-part-4\">encoder transformer network from scratch<\/a> as a follow-up <a href=\"https:\/\/steffenhaeussler.github.io\/posts\/attention_layer\/\">of understanding the attention layer<\/a> together with the <a href=\"https:\/\/colab.research.google.com\/drive\/1sE0B4NOAu9kqUTpuHIp1EYlD5JCAw4Gq?usp=sharing\">colab implementation<\/a>. I use a simplified dataset, where I don&rsquo;t expect great results. My approach is building something from scratch to understand it in depth. I faced many challenges during my implementation, so I aligned my code to the <a href=\"https:\/\/huggingface.co\/docs\/transformers\/model_doc\/bert#transformers.BertForSequenceClassification\">BertSequenceClassifier from huggingface<\/a>. My biggest challenge was to get the network to train. This challenge took me several months of low focus and a proper de- and reconstruction of the architecture. Minor issues were missing skip connections and some data preparation issues.<\/p>"},{"title":"Learning about time-series analysis","link":"https:\/\/steffenhaeussler.github.io\/posts\/2023-08-15-timeseries\/time_series\/","pubDate":"Tue, 15 Aug 2023 00:30:58 +0100","guid":"https:\/\/steffenhaeussler.github.io\/posts\/2023-08-15-timeseries\/time_series\/","description":"<p>Hi,<\/p>\n<p>Recently, I had to work on a simple time-series analysis. I performed poorly since I never worked with time-series before.\nI believe in a deterministic world, and in general, I prefer to find the causality of a specific data behavior prior to a simple way of empiristic modeling. However, I understand the need for time-series analysis as not enough data available, the underlying processes understood, the complexity bearable, or the time\/need for a proper process understanding. The goal is to make a prediction based on the previously observed observations. In a traditional sense (Arima), you look at the trend, seasonality, and cycles - in the more modern way, you throw the data into a model architecture (deep learning). In this context, I should mention the famous paper <a href=\"https:\/\/projecteuclid.org\/journals\/statistical-science\/volume-16\/issue-3\/Statistical-Modeling--The-Two-Cultures-with-comments-and-a\/10.1214\/ss\/1009213726.pdf\">Statistical Modeling: The Two Cultures<\/a>, while I prefer to use algorithmic models and treat the data mechanism as unknown. I would add that the underlying data mechanism is deterministic, and we should use collected data to get improved models. Anyway, let&rsquo;s use the many resources in the time-series field to get better in this field.<\/p>"},{"title":"Endpoint validation","link":"https:\/\/steffenhaeussler.github.io\/posts\/2023-08-07-pydantic\/pydantic\/","pubDate":"Mon, 07 Aug 2023 10:30:50 +0200","guid":"https:\/\/steffenhaeussler.github.io\/posts\/2023-08-07-pydantic\/pydantic\/","description":"<p>Hi,<\/p>\n<p>In my previous job, I spent hours debugging internal data transformations to figure out the received data from an external API was faulty. This issue would not appeared with schema validation. My fault was that I trusted the incoming data and didn\u2019t check for data consistency. Learning from mistakes and saving time, I would set up a small example for JSON validation via Pydantic. FastAPI relies heavily on pydantic and I use it for validating the incoming request and outgoing response. Anyway, not in every project FastAPI is used.<\/p>"},{"title":"Fast data transfer to or from s3","link":"https:\/\/steffenhaeussler.github.io\/posts\/2023-04-27-s3\/s3\/","pubDate":"Thu, 27 Apr 2023 10:30:58 +0100","guid":"https:\/\/steffenhaeussler.github.io\/posts\/2023-04-27-s3\/s3\/","description":"<p>Hi,<\/p>\n<p>This post is an homage to a <a href=\"https:\/\/stackoverflow.com\/questions\/56639630\/how-can-i-increase-my-aws-s3-upload-speed-when-using-boto3\/61809946#61809946\">stackoverflow post<\/a> copying data from s3. This shared work saved me a lot of time. I believe that individuals who share their work do not receive sufficient recognition.<\/p>\n<p>The problem is that I have multiple Gb of data separated into thousands of files. Those files are selected for download by the semi-automated pipeline for model training. So the number of files to download varies from pipeline run to pipeline run. Also, this makes any data preparation obsolete. The solution from the <a href=\"https:\/\/boto3.amazonaws.com\/v1\/documentation\/api\/latest\/guide\/s3-example-download-file.html\">official boto3 documentation<\/a> for copying data from s3 takes too long. Even with <a href=\"https:\/\/docs.python.org\/3\/library\/concurrent.futures.html\">asynchronous execution<\/a> in the download, it will take a few hours to download those files.  Imagine a scenario where you want to fine-tune a deep learning model on a machine with multiple GPUs, but you have to wait several hours for the data to be copied \ud83d\ude31. Any preprocessing steps are not feasible since the data is filtered upon request. Additionally, downloading the data via aws cli is not an option, as there is much more data in the s3 buckets than requested for model training. The simplest approach is to increase the throughput. And here is the beauty, directly copy+pasted from <a href=\"https:\/\/stackoverflow.com\/questions\/56639630\/how-can-i-increase-my-aws-s3-upload-speed-when-using-boto3\/61809946#61809946\">Pierre D<\/a>:<\/p>"},{"title":"Training a language model from scratch","link":"https:\/\/steffenhaeussler.github.io\/posts\/2023-04-21-training\/llm\/","pubDate":"Sat, 15 Apr 2023 10:30:58 +0100","guid":"https:\/\/steffenhaeussler.github.io\/posts\/2023-04-21-training\/llm\/","description":"<p>Hi,<\/p>\n<p>This post is a short overview over a <a href=\"https:\/\/www.kaggle.com\/code\/steffenhaeussler\/train-a-language-model-from-scratch\/notebook\">work project<\/a>, where I trained a language model for invoices. This so-called base model is then fine-tuned for text classification on customer data. Due to data privacy, a non-disclosure agreement, ISO 27001 and SOAP2, I&rsquo;m not allowed to publish any results. Believe me, it works like \ud83d\ude80\u2728\ud83e\ude90.<\/p>\n<p>A language model is trained on large amounts of textual data to understand the patterns and structure of language. The primary goal of a language model is to predict the probability of the next word or sequence of words in a sentence given the previous words.<\/p>"},{"title":"Cookie-cutter Problems","link":"https:\/\/steffenhaeussler.github.io\/posts\/2023-04-10-cookie\/cookiecutter\/","pubDate":"Mon, 10 Apr 2023 10:30:58 +0100","guid":"https:\/\/steffenhaeussler.github.io\/posts\/2023-04-10-cookie\/cookiecutter\/","description":"<p>Hi,<\/p>\n<p>Recently, I started to put some scripts together and run them against a Kaggle dataset. I decided to train my skills on an unseen dataset. Training keeps me sharp, and I need it to complement my skill set. For the last 2,5 years, I struggled in a small team with NLP problems, where I worked mostly on engineering tasks. My understanding in this area is not where I wanted to be. And on top, I follow this natural human process called forgetting things. For example, I definitely can&rsquo;t write all relevant stochiometric formulas of the chemo-lithotrophic denitrification by memory. This was very important during my Ph.D. When did I start to forget relevant information? It&rsquo;s funny to think back.  \ud83e\udd37<\/p>"},{"title":"Stratified multi-label split","link":"https:\/\/steffenhaeussler.github.io\/posts\/2023-04-09-stratified\/multi_label_split\/","pubDate":"Sat, 08 Apr 2023 10:30:58 +0100","guid":"https:\/\/steffenhaeussler.github.io\/posts\/2023-04-09-stratified\/multi_label_split\/","description":"<p>Hi,<\/p>\n<p>This post is a short overview of a stratified multi-label train-test split. Please look at the <a href=\"https:\/\/colab.research.google.com\/drive\/1SdJKRef4sZYowuddGIOzN8PVGH9PngyF?usp=sharing\">colab implementation<\/a> for a step through guide.<\/p>\n<p>Sometimes you step into work problems, which justify a small post. I already saw colleagues struggling to balance the train-test split for multi-label classification.\nIn classification problems, we have often a dataset with an imbalanced number of classes. In general, it is desired to keep the proportions of each label for the train and test sets as observed as in the original dataset. This stratified train-test split works well with single-label classification problems. For multi-label classification it is unclear how stratified sampling should be performed. Therefor <a href=\"http:\/\/lpis.csd.auth.gr\/publications\/sechidis-ecmlpkdd-2011.pdf\">Sechidis et al. 2011<\/a> and <a href=\"http:\/\/proceedings.mlr.press\/v74\/szyma%C5%84ski17a\/szyma%C5%84ski17a.pdf\">Szymanski and Kajdanowicz 2017<\/a> developed an algorithm to provide balanced datasets for multi-label classification. The documentation of their algorithm can be found <a href=\"http:\/\/scikit.ml\/stratification.html\">in the scikit-multilearn package<\/a> and <a href=\"https:\/\/github.com\/scikit-multilearn\/scikit-multilearn\/blob\/master\/skmultilearn\/model_selection\/iterative_stratification.py#L175\">on github<\/a>.<\/p>"},{"title":"Understanding scaled-dot product attention and multi-head attention","link":"https:\/\/steffenhaeussler.github.io\/posts\/2023-03-19-attention\/attention_layer\/","pubDate":"Sat, 18 Mar 2023 10:30:58 +0100","guid":"https:\/\/steffenhaeussler.github.io\/posts\/2023-03-19-attention\/attention_layer\/","description":"<p>Hi,<\/p>\n<p>This post is a summary of my implementation of the scaled-dot product attention and multi-head attention. Please have a look at the <a href=\"https:\/\/colab.research.google.com\/drive\/1sE0B4NOAu9kqUTpuHIp1EYlD5JCAw4Gq?usp=sharing\">colab implementation<\/a> for a step through guide.<\/p>\n<p>Even though this post is five years too late, the best way of reviving knowledge is to write about it. Transformers are in transforming the world via ChatGPT, Bart, or LLama. The core of the transformer architecture is the self-attention layer. There are many attention mechanisms (listed in this <a href=\"https:\/\/lilianweng.github.io\/posts\/2018-06-24-attention\/\">great post by Lilian Weng<\/a>), but the scaled-dot product attention layer is used in general (<a href=\"https:\/\/proceedings.neurips.cc\/paper\/2017\/file\/3f5ee243547dee91fbd053c1c4a845aa-Paper.pdf\">Vaswani et al. 2017<\/a>). For a visual explanation of the transformer, look at the great post from <a href=\"https:\/\/jalammar.github.io\/illustrated-transformer\/\">Jay Alammar<\/a>. Please check <a href=\"https:\/\/www.youtube.com\/watch?v=kCc8FmEb1nY\">Andrej Karpathy&rsquo;s video<\/a> for the full implementation of a transformer from scratch.<\/p>"},{"title":"The importance of building things by yourself","link":"https:\/\/steffenhaeussler.github.io\/posts\/2023-03-05-first\/first\/","pubDate":"Sun, 05 Mar 2023 23:30:58 +0100","guid":"https:\/\/steffenhaeussler.github.io\/posts\/2023-03-05-first\/first\/","description":"<p>Hi,<\/p>\n<p>In this initial post, I want to draft the development of my <a href=\"https:\/\/github.com\/SteffenHaeussler\/fastapi_skeleton\/\">FastAPI skeleton<\/a>.<\/p>\n<p>At the beginning of my career as a Data Scientist, I ran into the typical problem of model deployment to production.\nIn a team of two scientists, I had the chance to write a micro-service <a href=\"https:\/\/github.com\/SteffenHaeussler\/flask_skeleton\">with Flask from scratch<\/a> out of necessity.<\/p>\n<p>My first service followed strongly the example of <a href=\"https:\/\/blog.miguelgrinberg.com\/post\/the-flask-mega-tutorial-part-i-hello-world\">Miguel Grinbergs great tutorial<\/a>. The reason was simple, I couldn&rsquo;t write proper code at this time. Besides no experience and the great help of my co-workers, I could write a production-ready micro-service in a few weeks with the following features:<\/p>"}]}}