94 points · by ChefboyOG · 6y ago · 76 comments
People I work with don't care that our notebook tools have rudimentary syntax highlighting or type-checking. We don't rely on our tools to make sure our code is written correctly. We just memorize the APIs and rely on experimentation to get things working.
Please don't make us use git. Checking out and checking in files is too slow! Oftentimes, Slacking code to a colleague is the best way to collaborate, and the fastest.
Don't make us use confusing and broken authentication schemes to access our data! I work best if I can just download live data to my machine and work locally. If it's too big or it's something like streaming, just give me an admin password that I can save in my notebook and use to hit some database clusters. Nothing wrong with that!
- People thinking if Jupyter notebooks had just the right CSS and animations, it'd make machine learning unstuck.
- People coming from web dev and thinking that ML folks are somehow unaware of Docker/CICD/Kubernetes/Git and if they could just be enlightened, they'd be much more productive.
- People coming from a background of publishing blog posts/Youtube videos about machine learning, or who've worked with cute datasets who think that the actual workflow is someone giving you a CSV and a metric to optimize for à la Kaggle and building something around that workflow. This is for ML what Aikido is for fighting: it only works if your opponent knows the script and agrees to fall when you go Hayaaa!
Disclosure: we're working on our machine learning platform[0] because we desperately need it. We do not come from a web dev or blogging background, and it shows. We're building it because we spent seven years actually delivering machine learning products to paying enterprise in the mid six figures contracts with actual money, trust, and careers on the line. We've done it OK enough to have companies trust us and become repeat customers, but, anyone we faced the problems that anyone who has worked on actual projects has faced. Just getting to formulate the problem is akin to extracting Ramses II's brain through his nostrils. Agreeing on the data to use and then getting the data to a usable form takes a long time. Defining the real world metric is not obvious [if only it just boiled down to F1/AUC/ROC/ETC]. Most things that matter are done by a team, and tools work great for one individual, but break for teams. Just getting results to the client makes the work an endangered specie in an "only one result out of 100 makes it to the client".
It is unbelievable how much these problems impact the team. People can quit over this and we've suffered a lot.
So we're building around our workflow that has generated actual revenues with very large organizations that were satisfied enough to come back for more projects. It is not a perfect workflow, but it is from the real world on real projects and real clients that paid real money to solve real problems.
And we're building it for ourselves to use on actual projects. We aim for 10x improvement.
[0]: https://iko.ai
What we have here is the: "I don't get it, why don't you read this 500 pages manual and type in those 10 commands to print your document" era of computing. People wondered why people had trouble "just" programming something.
That is not the job to be done. There are huge frictions and broken interfaces between roles: developers, engineers, data scientists, domain experts with everyone expecting the other to "just" do X.
If data scientists just wrote better code. If developers just were more familiar with machine learning. If ML engineers just could be more CICD aware. If domain experts just could get it right. This is not working.
The only friction I see with data analysis roles is that data analysts typically don't need (or even outright refuse) to do collaborative work where there are multiple people working on the same code and data.
Once we take the collaborative aspect out, and we see data analysts who never had to check out someone else's work to apply minor changes or have someone else apply minor changes to their own code, then we get to the same naive criticism directed at basic organizational practices and tools as we see here.
Choice excerpts:
* co-ordinating code between team members by having everyone periodically copy their code to one team members personal google drive, where one of them would then spend a day fixing merge conflicts by hand. When asked why they were doing it like that, would they like any help, git can probably solve these problems, they asserted that this worked fine with them.
* Spinning up machines in EC2, then keeping track of keys (new one for every machine obviously) by storing the Pem files in an S3 bucket when they remembered. This didn't happen, so instead we had a dozen machines nobody could get into anymore after they left...
* Calling Python code in another file, by running os.spawn, calling a python interpreter with the given file, passing in parameters a cmd line arguments, and getting the result by waiting for a specifically named file to be written to disk. When asked "why are you doing this?" I was told "because it was easier".
* All the python they wrote eschewed functions were possible, with everything at root-indentation & no import guards (so it couldn't be imported safely). Functions, when they were used relied heavily on global variables and other objects/imports/etc being present implicitly. There were also logging and json serialisation functions that were hand written. When I asked why this teammate did this they replied "it only took me a couple of minutes and it works? What's wrong?" Unsurprisingly, it didn't serialised datetime objects correctly...
* Re-inventing the functionality offered by Pythons multiprocessing/ Joblib libraries-but worse- by shelling out (again) and manually calling a shell script to detect the number of CPU's and then using x-args to spawn the python processes. "Well we've written it now and it works but maybe next time". Unsurprisingly, these processes would fail, silently and lose data.
* Using eval() in production code because they "couldn't figure out a better way of getting the value of the attribute" despite being told that getattr is safer and faster.
* Maintaining a spark cluster full of Jupiter notebooks unhelpfully named things like STEP_301.ipynb, STEP_405.ipynb and not anything that told you _what_ they did. Figuring out which notebooks called which other notebooks and where any bit of code came from was, unsurprisingly literally kafkaesque. These eventually got checked into git (root credentials, embedded images and all), in a single commit with the message "add to repo".
* Instead of reading the documentation, or using something like SqlAlchemy, code samples of how to connect to various different types of database (mysql, Postgres etc) were stored in a random google doc (once again, one of their personal accounts) and access was passed around.
GUI tools only help with that to some extent, too, and only the right ones.
Although I really dislike GUIs in general so maybe that's it.
It has more users, I think, than even the “visual” source control systems that are supposed to be more usable.
In your personal opinion, what's so "bottom up" about checking out code from a repository and committing changes to a branch?
> (...) while at the same time it exposes an interface that makes it all to easy to screw things up catastrophically.
What? Care to point out a single example of what you perceive as being one of those "catastrophical" failures?
In all my professional life, which includes a bunch of years as a data analysis, I never experienced a single failure with git. Not a single one.
In fact, the only failure I ever experienced with git came from a stupid error I once made by tracking a git repository which found its way into a Dropbox shared folder.
Care to shed some light on what you perceive as being your pain points?
Not sure how you can trust anything else in the post with that obvious of a strawman argument. I'm not going to spend the time trying.
It's more common in the young, but also has a much better prognosis.
In particular I've seen my share of code written by non-developers, and they all make the same classes of mistakes one makes when you have less than a couple thousand hours of focused development work under your belt. Well we can't do that because X, or we don't need that because Y. Oh, okay. Is that why I have to come tow you out of the proverbial mud every couple of months?
Could you humor me and try a few of these things out? I think it'll help.
What people fear most is automated systems that are constructed on wishful thinking, not healthy skepticism. A lot of our processes are about proving to ourselves what we think we already know. There is plenty of code under the AI umbrella for which very conventional unit tests could be written. If you can't use our practices for ML, you'd better drop what you're doing and start developing parity, instead of bullshitting yourselves and everyone else about your exceptionalism.
Code that makes decisions for or about people needs more ceremony and sobriety around it, not less. If you can't do at least as well as a startup (which is a pretty low bar), then we are really in some deep doodoo. But not to worry. The good news is that when the machines take over and we have to hide underground, you'll be the first ones we eat, so you won't suffer long.
If you're iterating on your approach to a model, it really is a drag to do a bunch of bullshit in order to run an experiment that's likely to fail and just be thrown out anyways.
If you're shipping that model to production and affecting people's lives, it should really be held to a different standard than the "fuck around and see what happens" experiments.
And this is before we even get into unexplainability of deep neural nets.
The main problem is that "data scientists" don't follow procedures at all in their work. If they applied conventional software engineering so far as it applies they would do a lot better.(e.g. use version controls but don't check the database password in, think carefully what configuration goes with the hardware, the "model" in general, a particular instance of the "model", etc.)
ML projects get you in trouble in other areas.
For one thing, an ML project might involve a step that takes 24 hours or more to train a model. This means you have to schedule in terms of calendar time (e.g. can't start task A until task B is complete) as opposed to punch clock time, story points, or whatever passes for reality in your flavor of agile.
Related to that is automated testing. Normal software "works or doesn't work" but ML software is expected to get it wrong a certain fraction of the time so the question of "Is version x.y.z good to ship?" is fundamentally different in nature with ordinary software.
It irks me particularly that he ends his circle with "harvest insights" when any real game theorist knows it is about taking actions based on information -- e.g. why winners at gambling and trading use the Kelly Criterion.
Seems to me the author decided to write about topics he knows nothing about.
I do tend to agree that it’s made some dramatic improvements regarding utility over the last few years, but...
GP is otherwise right. First figure in the article is a joke. And that makes the article a joke.
Plenty of waterfalls out there. Even more non-waterfalls, aware of iterative, modern process, who will kick you out of the discussion if you try to sell them waterfall.
ML processes need innovation over those of traditional s/w dev. This article is the worst place on the internet to look for that innovation.
The stuff Frank Lloyd Wright didn't know about construction could fill an entire tour. Which I discovered by taking that tour. Boy, did that dude try to ignore physics.
I despise python, but MATLAB is positively satanic by comparison (from a software quality perspective at least)
https://papers.nips.cc/paper/5656-hidden-technical-debt-in-m...
The Abstract:
Machine learning offers a fantastically powerful toolkit for building useful complex prediction systems quickly. This paper argues it is dangerous to think of these quick wins as coming for free. Using the software engineering framework of technical debt, we find it is common to incur massive ongoing maintenance costs in real-world ML systems. We explore several ML-specific risk factors to account for in system design. These include boundary erosion, entanglement, hidden feedback loops, undeclared consumers, data dependencies, configuration issues, changes in the external world, and a variety of system-level anti-patterns.
As many in the comments have pointed out about the actual situation, the two process models in the figure need to be swapped (better yet: replace ML model with the words "no rhyme or reason ad-hoc BS").
As it stands, ML, data-science, computational-science, acadamics are the worst offenders when it comes to following a sane s/w engineering model for whatever they're doing. (for crying out loud, some even refuse to use anything other than FORTRAN-77 ... !!!)
Every ML, data-science, academic team needs to hire at least one traditional s/w engineer experienced in proper modern s/w development.
And they need to take that person seriously instead of being jackasses thinking they have the PhD degrees, or are PhD candidates, and that person doesn't.
It's a fallacy to believe that there is a bright line distinction though, and that no engineering practices or tools will improve your research productivity. Traditionally e.g. academic labs traditionally eschew all such approaches not because they wouldn't benefit, but because they don't understand what they are missing and have little incentive to learn, and few opportunities for it.
Most ML projects in industry are leveraging understood techniques in novel ways to build real customer facing products within reasonable investment timelines. To say that one can't provide any scope or estimates on these seems weak.
On the other hand, there are practices that can save you a ton of time even if you are working alone. In an academic setting this can often mean you just learn the ineffectual techniques of whomever came before you. In this case a small amount of education and change of practice (i.e. process) absolutely can dramatically improve overall lab productiveness. Industry isn't immune at all - especially when treating your "R&D" group quite separately from your "production engineering".
Another thing to remember is that there is no such thing as no process; you have one even if you don't understand it. It can be lightweight and almost invariably you can improve it (thought that's not always worth the time spent)
For a ML-heavy project I ended up being the "productionize this stuff" guy. My favorite was a bunch of python code that depended on a library that under the hood would spin up a new JVM instance to do some NLP work every time it was called (or whatever incorrect way they were using it caused this to happen). And they wanted to do this in the context of a synchronous HTTP request/response cycle.
My overall impression was that these were incredibly smart people, but they had no interest in understanding the context in which their code was going to run, or in understanding business requirements around reliability or maintainability. They just wanted to hack on cool projects that they found interesting.
Given that, it doesn't really surprise me that a lot of ML/data science people don't "get" accepted software development processes. There were some who made the leap and learned to understand why some of these practices are useful and tend to give you a better product, but they seem to unfortunately be in the minority. This is a pretty young field/subfield, and I think it's to be expected that practices are pretty raw and underdeveloped.
The lead-graphic misrepresents software development processes, the machine learning process is just an agile process which as a "software engineering process" directly counters the article's title, it clearly does work for machine learning.
Dealing with data teams that just won't learn reasonable software engineering practices but still want to run software in production is incredibly painful. Eventually you just have to sit down with them and lay down the ground rules on what is and isn't acceptable.
Once they get over the initial stage of complaining they eventually convert and can't understand why they ever did it wrong in the first place... just like junior software engineers.
The snowflake part where they feel they are somehow different and entitled to use poor processes and force poor tools and ecosystems on everyone else though really does irk me. Yes your field is quickly expanding, yes your salary is probably over-inflated vs your competence and experience but that doesn't make you special.
There are also a lot of DS people wrestling with the deeper challenges at the heart of MLOps and beyond just advocating sane team-based workflows, are looking at ways to harden and structure ML specific processes in the planning, design, build, and deploy phases.
Sean Taylor at Lyft on choosing metrics - https://medium.com/@seanjtaylor/designing-and-evaluating-met...
Test coverage of ML models and a good discussion on why and how ML code testing isn't the same as traditional testing - https://www.jeremyjordan.me/testing-ml/
A tool for Behavioral testing of NLP models - https://github.com/marcotcr/checklist
How to be a 10x data scientist (spoiler: have a professional end to end workflow) - https://towardsdatascience.com/how-to-be-a-10x-data-scientis...
Ml-specific technical debt, how to measure it, some ideas on how to handle it, this paper has spawned a lot of great tools - http://papers.nips.cc/paper/5656-hidden-technical-debt-in-ma...
Adversarial instance and outlier detection - https://github.com/SeldonIO/alibi-detect
And of course a whole suite of tools and research beingn done on data, pipeline, and model management, optimizing deployment and serving, explainability and interpretability, all in the service of applying enterprise-ready, engineering-grade rigor to data science.
And then you read something like this and want to tear your hair out.
The very first thing in the article is a comparison of Waterfall and Agile but it is labelled "Software Engineering" and "Machine Learning"?!
Like, I am so confused. Is the implication that AI researches invented Agile or something? Literally everybody does (or pretends to do) some kind of Agile these days. And I don't mean this in a "my enlightened startup does software dev like this" way, big corporations have the actual job title SCRUM master for years now. I did mom-and-pop store Wordpress projects with "machine learning methods" apparently - nice!
After wording this out I brought myself to read the whole article, and, well, it is a marketing piece for their productivity tool Comet which solves all the problem you have by building AI, which does not have "The provable correctness of software engineering" (I wish software would be provably correct :| ).
But my work in both building backend services and building machine learning models has always looked like how the author describes machine learning models.
In my experience the "process" generally isn't that different; but the cycle times are long enough for machine learning that it can feel different.