New tech3 min read

AI & MLOps, from the ground up

I'm learning how machine learning actually gets built, shipped and kept alive. These are my notes from the very beginning.

Neue Technik3 Min. Lesezeit

KI & MLOps von Grund auf

Ich lerne, wie Machine Learning wirklich gebaut, ausgeliefert und am Leben gehalten wird. Das sind meine Notizen von Anfang an.

ന്യൂ ടെക്3 മിനിറ്റ് വായന

AI-യും MLOps-ഉം, അടിത്തറ മുതൽ

മെഷീൻ ലേണിംഗ് ശരിക്കും എങ്ങനെ നിർമ്മിക്കപ്പെടുന്നു, എത്തിക്കപ്പെടുന്നു, ജീവനോടെ നിലനിർത്തപ്പെടുന്നു എന്ന് ഞാൻ പഠിക്കുകയാണ്. തുടക്കം മുതലുള്ള എന്റെ കുറിപ്പുകളാണിത്.

The ML lifecycle
The ML lifecycleIllustration: Desly PeterDer ML-LebenszyklusIllustration: Desly PeterML ജീവിതചക്രംചിത്രീകരണം: ഡെസ്ലി പീറ്റർ

Everyone is talking about AI. Every app has an AI button now, every company has an AI strategy, and every second post I see is someone explaining how AI will change everything. At some point I realised I'd been reading about it far more than I understood it.

So I decided to stop just reading and actually learn it. Properly, from the ground up. The illustration above is the loop I'm trying to understand: data, training, tracking, serving, monitoring, and back to retraining again.

Why MLOps and not just "AI"

Training a model in a notebook is the fun, exciting part. You load some data, run a few lines of code, and suddenly the computer is predicting things. It feels like magic.

But a model sitting in a notebook on my laptop doesn't help anyone. The hard part, and the part I find genuinely interesting, is everything after that. How do you turn it into something people can actually use? How do you know it still works next month, when the data has changed? How do you update it without breaking things? That's MLOps: the engineering that takes machine learning from an experiment to something reliable.

Building a model is the beginning. Keeping it working is the real job.

My plan

I wrote myself a roadmap. Twenty-four weeks, about 8 to 10 hours a week, starting with Python and data foundations and ending with a model that is deployed, monitored, and can be retrained safely.

The idea I like most is to build one project the whole way through instead of lots of small disconnected exercises. It starts as a simple notebook and grows step by step: into a tested Python package, then a tracked and reproducible training pipeline, then an API, then a container, then something running in the cloud with dashboards watching it. Every new skill gets added to the same system, so I can see why it matters.

My weeks have a rhythm, too: a couple of hours learning concepts, most of the time building, an hour or two on testing and automation, and one hour at the end to look back and write down what I learned. That last hour is the one I'm most tempted to skip, and probably the most important.

Where I actually am

Honestly? Right at the start. Phase 0. I've set up the project, the tools and the structure. My first real test checks that a function calculating an average still gives the right answer with negative numbers. Not exactly artificial intelligence.

But that's kind of the point. My first checkpoint is that a single command can check my code style and run all my tests, and pass. It's small and unglamorous, and it's the foundation everything else will stand on. I'd rather build that properly now than have a clever model on top of a mess later.

The tools I'll be learning

For anyone curious, the plan is one tool per problem to start with: Python with pandas and scikit-learn for the machine learning, pytest for testing, MLflow to track experiments, DVC to version data, FastAPI to serve predictions, Docker to package everything, GitHub Actions to automate it, and Prometheus, Grafana and Evidently to monitor it. My roadmap has a line I keep coming back to: the exact tools matter less than understanding reproducibility, automation, observability and safe change.

What I'd tell someone starting today

Start smaller than you think. Pick a boring, simple problem with public data. Get the basics working end to end before chasing the fancy stuff. And write down what you learn every week, because future you will forget.

I'll keep writing here as I go. The wins, the bugs, and the moments where I have no idea what I'm doing. Which, I suspect, will be most of them.

Status: Phase 0 complete-ish. 23 weeks to go.

— Desly

Alle reden über KI. Jede App hat jetzt einen KI-Knopf, jede Firma eine KI-Strategie, und jeder zweite Post, den ich sehe, erklärt, wie KI alles verändern wird. Irgendwann wurde mir klar, dass ich viel mehr darüber gelesen hatte, als ich verstand.

Also habe ich beschlossen, nicht mehr nur zu lesen, sondern es wirklich zu lernen. Richtig, von Grund auf. Die Illustration oben zeigt den Kreislauf, den ich verstehen will: Daten, Training, Tracking, Bereitstellung, Monitoring und zurück zum erneuten Training.

Warum MLOps und nicht einfach „KI“

Ein Modell in einem Notebook zu trainieren ist der spaßige, aufregende Teil. Man lädt ein paar Daten, führt ein paar Zeilen Code aus, und plötzlich sagt der Computer Dinge voraus. Es fühlt sich wie Magie an.

Aber ein Modell, das in einem Notebook auf meinem Laptop liegt, hilft niemandem. Der schwierige Teil, und der, den ich wirklich spannend finde, ist alles danach. Wie macht man daraus etwas, das Menschen tatsächlich nutzen können? Woher weiß man, dass es nächsten Monat noch funktioniert, wenn sich die Daten geändert haben? Wie aktualisiert man es, ohne etwas kaputtzumachen? Das ist MLOps: das Engineering, das Machine Learning vom Experiment zu etwas Verlässlichem macht.

Ein Modell zu bauen ist der Anfang. Es am Laufen zu halten ist die eigentliche Arbeit.

Mein Plan

Ich habe mir eine Roadmap geschrieben. Vierundzwanzig Wochen, etwa 8 bis 10 Stunden pro Woche, beginnend mit Python und Datengrundlagen und endend mit einem Modell, das ausgerollt ist, überwacht wird und sicher neu trainiert werden kann.

Die Idee, die mir am besten gefällt: ein einziges Projekt komplett durchbauen statt vieler kleiner, unverbundener Übungen. Es beginnt als einfaches Notebook und wächst Schritt für Schritt: zu einem getesteten Python-Paket, dann zu einer nachverfolgten, reproduzierbaren Trainings-Pipeline, dann zu einer API, dann zu einem Container, dann zu etwas, das in der Cloud läuft, mit Dashboards, die es beobachten. Jede neue Fähigkeit kommt in dasselbe System, damit ich sehe, warum sie wichtig ist.

Meine Wochen haben auch einen Rhythmus: ein paar Stunden Konzepte lernen, die meiste Zeit bauen, ein, zwei Stunden für Tests und Automatisierung und am Ende eine Stunde, um zurückzublicken und aufzuschreiben, was ich gelernt habe. Diese letzte Stunde ist die, die ich am liebsten auslassen würde, und wahrscheinlich die wichtigste.

Wo ich wirklich stehe

Ehrlich? Ganz am Anfang. Phase 0. Ich habe das Projekt, die Tools und die Struktur aufgesetzt. Mein erster echter Test prüft, ob eine Funktion, die einen Durchschnitt berechnet, auch mit negativen Zahlen das richtige Ergebnis liefert. Nicht gerade künstliche Intelligenz.

Aber genau darum geht es. Mein erster Meilenstein ist, dass ein einziger Befehl meinen Codestil prüft, alle Tests ausführt und durchläuft. Klein und unspektakulär, und das Fundament, auf dem alles andere steht. Ich baue das lieber jetzt richtig, als später ein cleveres Modell auf einem Chaos zu haben.

Die Tools, die ich lernen werde

Für Neugierige: Der Plan ist zunächst ein Tool pro Problem. Python mit pandas und scikit-learn fürs Machine Learning, pytest zum Testen, MLflow, um Experimente nachzuverfolgen, DVC, um Daten zu versionieren, FastAPI, um Vorhersagen bereitzustellen, Docker, um alles zu verpacken, GitHub Actions zur Automatisierung und Prometheus, Grafana und Evidently fürs Monitoring. In meiner Roadmap steht ein Satz, zu dem ich immer wieder zurückkehre: Die genauen Tools sind weniger wichtig, als Reproduzierbarkeit, Automatisierung, Beobachtbarkeit und sichere Änderungen zu verstehen.

Was ich jemandem raten würde, der heute anfängt

Fang kleiner an, als du denkst. Such dir ein langweiliges, einfaches Problem mit öffentlichen Daten. Bring die Grundlagen von Anfang bis Ende zum Laufen, bevor du dem schicken Zeug hinterherjagst. Und schreib jede Woche auf, was du gelernt hast, denn dein zukünftiges Ich wird es vergessen.

Ich schreibe hier weiter, während ich vorankomme. Die Erfolge, die Bugs und die Momente, in denen ich keine Ahnung habe, was ich tue. Was, so vermute ich, die meisten sein werden.

Stand: Phase 0 so gut wie fertig. Noch 23 Wochen.

— Desly

എല്ലാവരും AI-യെക്കുറിച്ച് സംസാരിക്കുന്നു. ഓരോ ആപ്പിനും ഇപ്പോൾ ഒരു AI ബട്ടണുണ്ട്, ഓരോ കമ്പനിക്കും ഒരു AI സ്ട്രാറ്റജിയുണ്ട്, ഞാൻ കാണുന്ന ഓരോ രണ്ടാമത്തെ പോസ്റ്റും AI എല്ലാം മാറ്റുമെന്ന് വിശദീകരിക്കുന്ന ഒരാളുടേതാണ്. ഒരു ഘട്ടത്തിൽ, ഞാൻ ഇതിനെക്കുറിച്ച് മനസ്സിലാക്കിയതിനേക്കാൾ വളരെ കൂടുതൽ വായിക്കുകയായിരുന്നുവെന്ന് എനിക്ക് മനസ്സിലായി.

അതുകൊണ്ട് വെറുതെ വായിക്കുന്നത് നിർത്തി ശരിക്കും പഠിക്കാൻ ഞാൻ തീരുമാനിച്ചു. ശരിയായി, അടിത്തറ മുതൽ. മുകളിലെ ചിത്രീകരണം ഞാൻ മനസ്സിലാക്കാൻ ശ്രമിക്കുന്ന ചക്രമാണ്: ഡാറ്റ, ട്രെയിനിംഗ്, ട്രാക്കിംഗ്, സെർവിംഗ്, മോണിറ്ററിംഗ്, പിന്നെ വീണ്ടും റീട്രെയിനിംഗിലേക്ക്.

വെറും "AI" അല്ല, MLOps എന്തുകൊണ്ട്

ഒരു നോട്ട്ബുക്കിൽ ഒരു മോഡൽ ട്രെയിൻ ചെയ്യുന്നതാണ് രസകരമായ, ആവേശകരമായ ഭാഗം. കുറച്ച് ഡാറ്റ ലോഡ് ചെയ്യുന്നു, കുറച്ച് വരി കോഡ് ഓടിക്കുന്നു, പെട്ടെന്ന് കമ്പ്യൂട്ടർ കാര്യങ്ങൾ പ്രവചിക്കുന്നു. ഒരു മാജിക് പോലെ തോന്നും.

പക്ഷേ എന്റെ ലാപ്ടോപ്പിലെ ഒരു നോട്ട്ബുക്കിൽ ഇരിക്കുന്ന ഒരു മോഡൽ ആരെയും സഹായിക്കുന്നില്ല. കഠിനമായ ഭാഗം, എനിക്ക് ശരിക്കും രസകരമായി തോന്നുന്ന ഭാഗം, അതിനുശേഷമുള്ള എല്ലാമാണ്. ആളുകൾക്ക് ശരിക്കും ഉപയോഗിക്കാൻ കഴിയുന്ന ഒന്നാക്കി അത് എങ്ങനെ മാറ്റും? ഡാറ്റ മാറിയ അടുത്ത മാസവും അത് പ്രവർത്തിക്കുന്നുണ്ടെന്ന് എങ്ങനെ അറിയും? കാര്യങ്ങൾ തകർക്കാതെ എങ്ങനെ അപ്ഡേറ്റ് ചെയ്യും? അതാണ് MLOps: മെഷീൻ ലേണിംഗിനെ ഒരു പരീക്ഷണത്തിൽ നിന്ന് വിശ്വസനീയമായ ഒന്നിലേക്ക് കൊണ്ടുപോകുന്ന എഞ്ചിനീയറിംഗ്.

ഒരു മോഡൽ നിർമ്മിക്കുന്നത് തുടക്കമാണ്. അത് പ്രവർത്തിപ്പിച്ചുനിർത്തുന്നതാണ് യഥാർത്ഥ ജോലി.

എന്റെ പ്ലാൻ

ഞാൻ എനിക്കായി ഒരു റോഡ്മാപ്പ് എഴുതി. ഇരുപത്തിനാല് ആഴ്ച, ആഴ്ചയിൽ ഏകദേശം 8 മുതൽ 10 വരെ മണിക്കൂർ, Python-ഉം ഡാറ്റാ അടിസ്ഥാനങ്ങളും കൊണ്ട് തുടങ്ങി, വിന്യസിക്കപ്പെട്ട, നിരീക്ഷിക്കപ്പെടുന്ന, സുരക്ഷിതമായി റീട്രെയിൻ ചെയ്യാവുന്ന ഒരു മോഡലിൽ അവസാനിക്കുന്നു.

എനിക്ക് ഏറ്റവും ഇഷ്ടമുള്ള ആശയം, ബന്ധമില്ലാത്ത ഒരുപാട് ചെറിയ അഭ്യാസങ്ങൾക്ക് പകരം ഒരൊറ്റ പ്രോജക്റ്റ് മുഴുവനായി നിർമ്മിക്കുക എന്നതാണ്. ഒരു ലളിതമായ നോട്ട്ബുക്കായി തുടങ്ങി പടിപടിയായി വളരുന്നു: ടെസ്റ്റ് ചെയ്ത ഒരു Python പാക്കേജായി, പിന്നെ ട്രാക്ക് ചെയ്യപ്പെടുന്ന, ആവർത്തിക്കാവുന്ന ഒരു ട്രെയിനിംഗ് പൈപ്പ്‌ലൈനായി, പിന്നെ ഒരു API, പിന്നെ ഒരു കണ്ടെയ്നർ, പിന്നെ ഡാഷ്ബോർഡുകൾ നിരീക്ഷിക്കുന്ന, ക്ലൗഡിൽ പ്രവർത്തിക്കുന്ന ഒന്ന്. ഓരോ പുതിയ കഴിവും ഒരേ സിസ്റ്റത്തിലേക്ക് ചേർക്കപ്പെടുന്നു, അതുകൊണ്ട് അത് എന്തുകൊണ്ട് പ്രധാനമാണെന്ന് എനിക്ക് കാണാം.

എന്റെ ആഴ്ചകൾക്ക് ഒരു താളവുമുണ്ട്: ആശയങ്ങൾ പഠിക്കാൻ രണ്ട് മണിക്കൂർ, കൂടുതൽ സമയവും നിർമ്മാണം, ടെസ്റ്റിംഗിനും ഓട്ടോമേഷനും ഒന്നോ രണ്ടോ മണിക്കൂർ, അവസാനം തിരിഞ്ഞുനോക്കി പഠിച്ചത് എഴുതിവെക്കാൻ ഒരു മണിക്കൂർ. ആ അവസാന മണിക്കൂറാണ് ഒഴിവാക്കാൻ ഏറ്റവും പ്രലോഭനമുള്ളത്, ഒരുപക്ഷേ ഏറ്റവും പ്രധാനപ്പെട്ടതും.

ഞാൻ ശരിക്കും എവിടെയാണ്

സത്യം പറഞ്ഞാൽ? തുടക്കത്തിൽ തന്നെ. ഘട്ടം 0. ഞാൻ പ്രോജക്റ്റും ടൂളുകളും ഘടനയും സെറ്റ് ചെയ്തു. എന്റെ ആദ്യത്തെ യഥാർത്ഥ ടെസ്റ്റ് പരിശോധിക്കുന്നത് ഒരു ശരാശരി കണക്കാക്കുന്ന ഫംഗ്ഷൻ നെഗറ്റീവ് സംഖ്യകളോടെയും ശരിയായ ഉത്തരം നൽകുന്നുണ്ടോ എന്നാണ്. കൃത്യമായി കൃത്രിമ ബുദ്ധിയല്ല.

പക്ഷേ അതാണ് കാര്യം. ഒരൊറ്റ കമാൻഡ് എന്റെ കോഡ് സ്റ്റൈൽ പരിശോധിക്കുകയും എന്റെ എല്ലാ ടെസ്റ്റുകളും ഓടിക്കുകയും പാസാകുകയും ചെയ്യുക എന്നതാണ് എന്റെ ആദ്യ ചെക്ക്‌പോയിന്റ്. ചെറുതും ആകർഷകമല്ലാത്തതുമാണ്, ബാക്കിയെല്ലാം നിൽക്കുന്ന അടിത്തറയുമാണ്. പിന്നീട് ഒരു കുഴപ്പത്തിന് മുകളിൽ ഒരു മിടുക്കൻ മോഡൽ ഉണ്ടാകുന്നതിനേക്കാൾ, ഇപ്പോൾ അത് ശരിയായി നിർമ്മിക്കാനാണ് എനിക്കിഷ്ടം.

ഞാൻ പഠിക്കാൻ പോകുന്ന ടൂളുകൾ

കൗതുകമുള്ളവർക്കായി, തുടക്കത്തിൽ ഓരോ പ്രശ്നത്തിനും ഒരു ടൂൾ എന്നതാണ് പ്ലാൻ: മെഷീൻ ലേണിംഗിന് pandas-ഉം scikit-learn-ഉം ഉള്ള Python, ടെസ്റ്റിംഗിന് pytest, പരീക്ഷണങ്ങൾ ട്രാക്ക് ചെയ്യാൻ MLflow, ഡാറ്റ വേർഷൻ ചെയ്യാൻ DVC, പ്രവചനങ്ങൾ നൽകാൻ FastAPI, എല്ലാം പാക്ക് ചെയ്യാൻ Docker, ഓട്ടോമേറ്റ് ചെയ്യാൻ GitHub Actions, നിരീക്ഷിക്കാൻ Prometheus, Grafana, Evidently. എന്റെ റോഡ്മാപ്പിൽ ഞാൻ വീണ്ടും വീണ്ടും തിരിച്ചെത്തുന്ന ഒരു വരിയുണ്ട്: ആവർത്തനക്ഷമത, ഓട്ടോമേഷൻ, നിരീക്ഷണക്ഷമത, സുരക്ഷിതമായ മാറ്റം എന്നിവ മനസ്സിലാക്കുന്നതിനേക്കാൾ കൃത്യമായ ടൂളുകൾക്ക് പ്രാധാന്യം കുറവാണ്.

ഇന്ന് തുടങ്ങുന്ന ഒരാളോട് ഞാൻ പറയുന്നത്

നിങ്ങൾ കരുതുന്നതിനേക്കാൾ ചെറുതായി തുടങ്ങുക. പബ്ലിക് ഡാറ്റയുള്ള ഒരു വിരസമായ, ലളിതമായ പ്രശ്നം തിരഞ്ഞെടുക്കുക. ആഡംബര കാര്യങ്ങൾക്ക് പിന്നാലെ പോകുന്നതിന് മുമ്പ് അടിസ്ഥാനങ്ങൾ തുടക്കം മുതൽ ഒടുക്കം വരെ പ്രവർത്തിപ്പിക്കുക. എല്ലാ ആഴ്ചയും പഠിച്ചത് എഴുതിവെക്കുക, കാരണം ഭാവിയിലെ നിങ്ങൾ മറക്കും.

പോകുന്ന വഴി ഞാൻ ഇവിടെ എഴുതിക്കൊണ്ടിരിക്കും. വിജയങ്ങൾ, ബഗുകൾ, ഞാൻ എന്താണ് ചെയ്യുന്നതെന്ന് എനിക്ക് ഒരു പിടിയുമില്ലാത്ത നിമിഷങ്ങൾ. അവയാകും ഭൂരിഭാഗവും എന്നാണ് എന്റെ സംശയം.

സ്ഥിതി: ഘട്ടം 0 ഏതാണ്ട് പൂർത്തിയായി. ഇനി 23 ആഴ്ച.

— ഡെസ്ലി