Need help with Drupal or Grav admin, site building, design, or content? Contact us!
Help Defend Democracy! â Join Battalion today.
Exploring the Symfony universe!
Last month I was in the Halifax airport and had to spend some Canadian dollars before heading back to the U.S. So I picked up two magazines' special issues on AI. They were the Harvard Business Review's How to Thrive in a Gen AI World and MIT Technology Review's Greetings from the Future.
As I read various articles on the flight I came up with the idea for this article, and asked myself is it possible to use "AI" ethically in a web stack?
So, I slowly wrote this post as I came across more items and did some research.
Let's start with some general observations.
If you follow me or have read my weekly news summaries, you know I am not a fan of AI. To this point I think it's a bunch of horseshit, especially generative AI. ML has been around a while and is mostly useful. Hopefully, gen AI will be eventually. But it will have a much bigger challenge being ethical.
Currently it:
Notice that all four of those drawbacks are due to human stupidity or c^ntness. Aka shit in, shit out. Just FYI as we go forward.
Plus in general it just doesn't fucking work.
It only:
In other words, its currently a big waste of money and electricity. Of course the idiots selling it and the bigger idiots buying it don't realize this.
This is true for anything humans have done throughout history. Just look at the shitshow that religion is. Or capitalism. I am sure you have read or seen dozens of examples of the garbage or hilarious results generative AI currently provides.
For now it's only useful for conspiracy theorists, propagandists, and other assholes. But it doesn't have to be that way.
So if you are going to use it, learn it, and get your shit together first.
Keeping the evil AI genie in the bottle is a choice between corporate governance which has always been a joke and regulatory governance which can work if done well. But, that's not likely is it? At least in the United States.
In my opinion, we can if we try extremely hard and very carefully. I am going to explore some solutions that are aimed at developers in the Symfony Universe. I will also list some ethical use cases for AI. And finally, suggest a partial stack.
The key to AI is to:
So, for the last two, focus on your data and clean it first. Again, no shit in, no shit out.
Now, let's look at some solutions in the Symfony adjacent web development space. We won't cover everything in the list above.
According to the Open Source Initiative:
'To be considered open source under the OSAID, an AI model has to provide enough information about its design so that a person could âsubstantiallyâ recreate it. The model must also disclose any pertinent details about its training data, including the provenance, how the data was processed, and how it can be obtained or licensed.
Many startups and big tech companies, most prominently Meta, have employed the term âopen sourceâ to describe their AI model release strategies â but few meet the OSAIDâs criteria.
Maffulli has been openly critical of Metaâs decision to call its models âopen source.â After discussions with the OSI, Google and Microsoft agreed to drop their use of the term for models that arenât fully open, but Meta hasnât, he said.' 1
So, are there any true Open Source AI models?
I am going to say no. But, the closest thing is Mistral with some of its open models. They are free for non-commercial use.
The French startup has a new product that shows how AI should be used.
Its newest releases are the first generative AI models designed to be run on edge devices, like laptops and phones. AKA keeping it local.
Called âLes Ministraux,â they can be used or tuned for a variety of applications, from basic text generation to working in conjunction with more capable models to complete tasks.
They can ingest roughly the length of a 50-page book. Thus, they do meet the keep it small and keep it local criteria.
âOur most innovative customers and partners have increasingly been asking for local, privacy-first inference for critical applications such as on-device translation, internet-less smart assistants, local analytics, and autonomous robotics,â Mistral writes. 2
They have launched a free service for developers to test its models, and a SDK to let customers fine-tune those models.
Mistral even has a generative model for code called Codestral.
Update 11/26/2024
Ai2 is a nonprofit AI research organization founded by the late Microsoft co-founder Paul Allen. They've released OLMo 2. It meets the Open Source Initiativeâs definition of open source AI. This means the tools and data used to develop it are publicly available.
Amazee is a player in the Drupal space offering AI hosting and services.
They note:
'As AI technology rapidly evolves, governments and public sector organizations are increasingly updating, creating, and rolling out legislative and compliance frameworks dealing specifically with data privacy, data ownership, and regulations regarding both the responsibility and the liability for the collection, usage, storage, and tracking of corporate and personal data.
At amazee.io, we have always emphasized the critical importance of data sovereigntyâespecially for organizations with stringent data protection requirementsâeven before we worked to extend our platform and service offering to cover LLMs, Machine Learning, and AI hosting.
It is a very different situation if your data is stored in Switzerland, Germany, or the United States. Consumers and enterprises want to ensure that their data is only used for approved purposes.' 9
In this case they go small by only using customer data and keep data local by hosting it based on your country.
Once your AI use is integrated, be sure to create automatic and continuous data feedback loops. This will improve its accuracy. And continually monitor it yourself.
Another good way to keep your AI use local is to only use it on your machine (when rolling your own) or via the other coding tools you use. Everyone in the PHP world has heard of PHP Storm and is probably using it.
They even have their own LLM. But, it is a paid feature so I won't cover it here. If you are interested check out Mellum: JetBrainsâ New LLM Built for Developers. It's also not open source but hopefully there will be something similar to it one day.
Regarding the AI integrated into their products JetBrains says:
'Code completion has always been a standout feature in JetBrains IDEs, helping developers code faster, smarter, and with fewer mistakes. But what if it could do even more? What if it could predict not just the next element but entire lines of code â or even complete blocks?
JetBrains offers two ways of delivering AI code completion:
Unlike tools that bombard you with overwhelming multi-line completions, our AI completion is calibrated to offer concise, relevant suggestions right when you need them.
While large models are often better at handling a variety of tasks, a tailored code model will perform better on specialized tasks. By training a relatively small, highly specialized model and enhancing inference mechanisms, weâve significantly improved code completion accuracy and speed.' 4
This meets the go small criteria.
'We completely reworked how multi-line suggestions are shown, especially in combination with in-IDE popup completions.
You can now accept completion suggestions token by token or line by line.
With offline and online evaluations in place to assess different retrieval-augmented generation (RAG) strategies, we chose the one that works stably and predictably. Suggestions now utilize the context of the entire project to offer relevant, high-quality blocks of code.' 4
Ok, we've looked at a few developer AI tools, so let's look at ways to put it to use.
If you are following all the strategies in my first list, here are some use cases where you can ethically use AI. Your situation will be unique of course.
Currently, translation is the best and most appropriate use case for AI. And it can be built into many tools.
This includes things like video transcription and generating alt text for images. However, there is room for a lot more work in this use case.
I would say improving accessibility is the second best use of AI.
These would be useful for any technology or product. They are a slimmed down accessory to the next use case.
This has the greatest potential but needs the most work and care.
It would be especially useful for personal learning guides.
Obviously programmers are interested in this use case.
Relating to code documentation, Mintlify is an AI generated documentation tool geared toward coding.
'It introduces AI-driven writing suggestions, interactive code snippets, and embedded analytics to transform the way documentation is created, maintained, and, most importantly, used.
Some key features include:
I am sure you have heard of Grammarly and email clients are adding their own AI solutions directly to their products. Unfortunately, the shit that is social media won't be far behind. It would be awesome if it blocked misinformation. But if it's commercial it won't. Hence the use open source criteria.
Editing, explanations, and other ways to get your ass sued off if you don't get it right.
This could be useful in any field. FAQ, help sections, chatbots, etc. are examples.
Things like automated calendars and reminders.
These would be useful but unfortunately that horse has left the barn and gen AI is generating entire horseshit articles on bullshit AI generated websites. And unfortunately lots of dipshits are using it.
This is a long way off in my option due to AI's shit accuracy.
So, we have looked at some AI solutions and use cases. Now, what would I recommend for a mostly ethical AI Stack for web development?
To start simple and standards-based are what we should go for here.
We should integrate AI via existing tools rather than world-changing "all in one solutions". Things like Amazee, PHPStorm, Grammarly, Drupal, etc.
For general site use we can integrate AI documentation, search/chatbots based on your sites' content if it is extensive enough, and possibly generate boilerplate code(?) into your new projects.
For now Mistral as seen above is the best option to integrate LLMs directly into your projects. You are rolling your own and Mistral is the inside of your spliff.
Amazee seems to be the most solid option at the moment. They have the expertise to help you integrate AI. SensioLabs and Platform SH won't be far behind with SaaS solutions.
Host and work with your code on Codeberg (hosted) or Forgejo (local). There is no AI for now but it will be coming one day. And most likely for code security checks. They are also integrating the Fediverse which is cool. They are open source.
Open Project is another open source option for project management. And works well with Nextcloud.
I recommend Nextcloud. It says:
'Nextcloud AI Assistant is a capable and versatile tool that enhances your work throughout Nextcloud Hub to keep writing, communication, and other productivity tasks simple and low effort.
Unlike other AI-powered content collaboration tools, Nextcloud doesnât share your data with a third party technology provider to train the core AI model. This means that all data you work with, including documents, emails, chats and more, stays yours (the local criteria).
We build the AI Assistant using a flexible, solution-independent approach which gives you a choice between multiple large language models (LLM) and services. It can be fully hosted within your instance, processing all requests in-house, or powered by an external service. And importantly, you can have a 100% open-source assistant.
You can ask Nextcloud Assistant about your own data with Context Chat. To answer questions about your documents and assets, Nextcloud Assistant gets access to data from different apps. You can manually define the scope and even limit it to a specific folder or file for more precision.
AI translation is available directly from Nextcloud Assistant menu. Translation options are now almost limitless, as we added support for hundreds of languages that apps can detect, read and translate to.' 7
Vanilla HTML, CSS, JavaScript, and PHP
Web components should be used for customization. AI in IDEs should be able to accomplish this without fucking it up.
PHP code generation should get there as well. Eventually. I mean Rector works so why not.
Symfony
Symfony should lend itself well to AI because it's componentized. Twig is a standard. And you can use Symfony UX rather than JavaScript platforms.
SymfonyCon Vienna has two upcoming sessions on AI
'Whether you're an AI enthusiast or a developer curious about machine learning, this session will equip you with the knowledge to implement ML inference in your Symfony applications.
This talk will show by example how to implement ONNX (Open Neural Network Exchange) and Transformer models to bring advanced AI capabilities to your Symfony projects.'
SymfonyCon Vienna 2024: Code Less, Create More: Unleashing AI Secret Weapons for Lazy(?) Developers!
'Join Thibault Milan as he explores the transformative power of AI in web development. Discover how tools like GitHub Copilot, Tabnine, Perplexity, and Azure OpenAI are revolutionizing his workflow, enabling faster ideation and seamless entry into new tech areas. Thibault will share insights on integrating AI to improve coding practices, overcome technical limitations, and venture into uncharted territory.
This talk will inspire every developer to view AI as a complement to their skills, not a competitor, preparing them for a future where AI tools are indispensable partners in innovation.'
We'll see where it goes with Symfony.
So far Drupal is the only Symfony-based CMS with any AI integrations I would trust. And they are just getting started. And of course it will be open source.
During his recent Driesnote at DrupalCon Barcelona, Dries Buyaert made some AI announcements.
He focused on AI integration within Drupal CMS aka Drupal Starshot.
He said:
'The AI-powered tools are designed to simplify everyday tasks, including renaming content types or configuring fields, reducing the need for manual intervention. These features will operate on four guiding principles:
These AI tools, particularly in content migration and site-building, will provide real value by speeding up processes that typically require developer input.'
Going into more detail he said:
For more details check out:
Drupal artificial intelligence (AI) community initiative
And for existing Drupal AI solutions (some of which I would not consider ethical use cases, for example OpenAI) see:
Coincidently, ImageX came out with a demonstration article on Drupal AI today. Great minds think alike.
ActivityPub can integrate alt text via AI. There will be feed and privacy solutions eventually.
Thanks for reading this half-formed and half-finished article on the ethical use of AI. It's kind of like ethical AI itself. It's not quite there yet. Still, I hope you learned some things and please let me know if I got something wrong. I am by no means an expert on AI and to this point I'm not a fan of it. Hopefully, I will be proved wrong in the long run. I'm not optimistic. And as a lifelong pessimist I am usually correct.
Anyway, check out some of the AI tools I covered and give them a try. Just remember the key is to:
Happy coding with a slight assist from AI. ;)
1 We finally have an âofficialâ definition for open source AI
2 Mistral releases new AI models optimized for laptops and phones
3 AI and LLM Data Privacy and Data Sovereignty: Navigating the Challenges
4 Complete the Un-Completable: The State of AI Completion in JetBrains IDEs
5 Meet the first open-source AI assistant that doesnât prey on your data
7 Meet the first open-source AI assistant that doesnât prey on your data
8 Getting started with Mintlify: The smart Documentation tool your team needs
9 AI and LLM Data Privacy and Data Sovereignty: Navigating the Challenges
Symfony Station covers the essential news in the Symfony, PHP, and Fediverse development communities with a focus on protecting democracy. Please use the button above to make a small donation to help cover our out-of-pocket costs. Our labor is provided free of charge to support the communities we write about.
Subscribe to The Payload, our weekly newsletter exploring the Symfony Universe.