How to create a complete AI tool?

Nicolas MARTIN
Nerd For Tech
Published in
14 min readJun 17, 2022

Last update: June 15th, 2023.

2022 is the Artificial Intelligence As A Service year (AIAAS), and many exciting services are still to come. However, developing an AI Web service is still tricky because many Artificial Intelligence models require a lot of memory or computation power, and very often both of them. Let’s see how to cope with those challenges, even for services on a large public scale.

AI Web service architecture. Image by the author.

Use an async framework

Something I wish I had known before is using a 100% async framework. Most ML processes are long and could be parallelized to answer several customers simultaneously. If it is a simple app covering the main requirements (user management, database, payment system, etc.), I recommend FastAPI with Tortoise ORM. Otherwise, Django is a good solution but requires additional extensions to manage async.
If you use a sync framework, the whole service will be blocked during an ML process, and the other users can only use the service once the process is complete, which is unfortunate.

Cloud services

The three primary cloud services from Google, Amazon, and Microsoft have similar functions. That’s why it is difficult to say which is the best.

Here is an overview of the three main cloud services, with some noticeable advantages.

Main cloud services. Image by the author.

For an AI Web service, 1 or 2 months of credit or a free trial is concise because the development cycles between your AI model and the other services are more prolonged than classic ones. Consequently, spending more time preparing the model and the services locally is highly recommended if you want to reduce costs before implementing the AI Web service in the cloud. Another good idea is to start working with 2 or 3 cloud services to see which fits your needs the best.

All three cloud services have plenty of servers worldwide, which is essential to make your AI Web service available quickly and anywhere.

There are also plenty of other cloud companies with attractive prices and services, but they might not be suited for large-scale AI Web service deployment.

In all cases, being very careful about the contract terms and the service cost is crucial. Many users have lost plenty of money due to a wrong evaluation of the service costs.

The leading cloud services provide many features but are sometimes only suitable for CPU machines. Many cloud services offer GPUs with competitive prices, many different machines, and good scalability features, but most don’t have all the services around the three main CPU cloud services.
Consequently, it could be necessary to have one cloud service for GPU that deal with ML tasks and one cloud service that deals with CPU tasks.

Here are some interesting GPU clouds services:

Cloud costs

Classic SAAS uses libraries that don’t require lots of hardware resources. This is far from the case with AI Web service: AI models are between a few megabytes to several gigabytes, and applying them at a large scale can have a considerable cost.

Remember, those models must be processed by libraries that generally take up much disk space. For instance, TensorFlow takes about 1Gb of disk space and, in many cases, more than twice in RAM space.

Cloud services use emulators like Unicorn, which increases disk space and RAM even more. That’s why the deployment in the cloud will differ from a local deployment due to a very different infrastructure.

However, cloud services can auto-scale the needed hardware resources regarding incoming new customers, making AI Web service possible. Autoscaling means adding or removing servers’ instances according to the current hardware capacity coverage (ex: if the server is at 70% of its GPU capacity, the cloud service creates a new one to avoid service degradation or breakdown).

Cloud services propose many hardware setups, from low memory/calculation power to high. Depending on the service model, you must fit it to the hardware as best as possible.

Cloud service average cost per model size and instance. Image by the author.

The previous table shows the cost per month per instance, which should be evaluated very carefully. An instance costing 500$ per month is relatively inexpensive because it could cover 10000 visits or more, generating 1000$ in sales with 1% of those 10000 visits.

Note that a 1-year contract would greatly reduce the GPU costs, and use GPU benchmarks like this one to compare prices with performance.

In addition, there are many solutions to reduce the memory, the training time, and the calculations necessary to run your model, like pruning, freezing, or lighter structures like TensorFlow-lite or ONNX. It might not be enough in many cases to have very fast AI Web service ; that’s why you have to deal with a specific AI Web service constraint: time.

Photo by Hannah Busing on Unsplash

Training times

Training times could be longer or shorter, depending on the data science process you are dealing with.

It mostly depends on the final model size and hardware, but it is also linked to the model complexity and the data type (image, text, sound, etc.).

Here is a simple comparison between 3 machines. It is not covering every scenario (NLP, image classification, etc.). It just gives a rough order of magnitude.

3 main hardware config for AI Web services in 2022. Image by the author.

The following table presents some duration values compared to model sizes.

Rough Order of Magnitude of training and processing time using the 3 hardware config. Image by the author.

Some models could be huge like GPT-3 and need powerful hardware like Nvidia’s A100. There are interesting things to know in terms of energy consumption, costs, and alternatives described in this article.

The other hardware setups are commonly used in the market or cloud platforms.

Processing times

Classic web services must answer in less than one second; otherwise, most users quit.

That’s why AI processes, which are longer than classic ones, could be seen as a handicap for a service.

Nevertheless, if AI is still faster than humans, people would wait if the benefit is worth the patience. That’s why it is necessary to show why the process takes several seconds thanks to a clear explanation (for example with a loading animated gif), or, if it is long, thanks to an on-demand service, which result will be sent in a few minutes or hours. Otherwise, cloud services have fast GPUs available to do very fast calculations, but it would increase the overall cost. Be careful because the cost might explode because of heavy hardware setups. Cloud cost simulators are here for that. Up to you to find the right balance.

Photo by Patrick Ward on Unsplash

In addition, there are other times to consider: the model installation and loading times. It happens when you deploy a service or add new instances automatically or not. This could be a problem when you must deal with larger models that take several minutes to install or load. In such a case, fast installation using SSD might be interesting.

Hardware for development

Even though everything could run on a web service, we cannot ignore that most devices used in the world are on Android and iOS and if our AI Web service is not running on smartphones, we will lose an important market share, even if the web service is adapted to smartphones. The fact is that most people prefer having their services in apps rather than in a web window.

Unfortunately, even if Mac has an optimized hardware architecture, it is not the best option to train models without a fast GPU. On the other hand, PCs cannot be used for iOS development due to Mac policy.

That’s why the cheapest solution to cover 100% of the device market, is to use a recent but affordable Mac to develop iOS apps with XCode, together with an ML cloud service like Paperspace to train models with GPUs.

Note: Even multi-platform languages such as Kotlin or Flutter require a Mac to develop iOS apps.

Hardware costs to cover 100%of the global market. Image by the author.

Keep in mind that there are deep learning libraries adapted to iOS and Android smartphones, but if the model is too large, you can access it remotely from an app with a secured web socket.

Security

AI Web service requires higher security than classic SAAS, due to the high processing cost that could be stolen, using hacking actions to get free requests. That’s why Recaptcha, CSRF protection, and all cloud security rules are mandatory.

Of course, payment systems must be fully secured using digitally signed webhooks.

It is highly recommended to use secured cloud services such as GCloud, Azure, or AWS: they will not protect you from all kinds of fraud, but they will at least secure all the inner connections between the database, the model, the interface and they provide protection options for a low price (ex: 1$ per month against DDOS attacks).

Photo by Mika Baumeister on Unsplash

Tests and sandboxes

Unfortunately, you can’t rely on a single environment like Chrome in Android to prove that your service works well. You will need to test it on every possible platform. Some Javascript code works well in Chrome and doesn’t work at all in Safari and vice-versa. Your code shall be adapted to every browser on every device (PC, Smartphone, tablet) on every screen format. This is quite demanding but necessary.

Once you have finished your service, you will soon need a sandbox platform to check if future major updates are correctly developed in all environments. Therefore, cloud platforms often propose low-cost sandbox machines and databases. Note that databases don’t have a 0 minimum instance: if you want to reduce costs as much as possible, you will want to create and delete it at every new major update.

Admin platform

Continuous improvement is not only possible through analytics tools but also through good reuse of the data.

All AI tools improve themselves thanks to their data and they keep it safe and anonymous.

That’s why an admin platform is necessary: to know all users’ statuses, service usage, parameters, feedback, results, and data.

Datasets can be extracted anonymously by getting random queries from the database. This kind of dataset is very important to improve the model because they are directly based on users’ experience.

An admin platform grants you advanced analytics and also a great model and service improvements.

Photo by dole777 on Unsplash

Financing

Even if you have a great model embedded in a great web service or app, you will need money to make it popular and pay for the hardware.

The cheapest way is to become popular in your AI tool field, which means a lot of work in social media.

If you don’t have enough social influence, you have to preview an advertising budget of around $10000 per year, and financing is always possible.

If you want to cover hardware, design services, and marketing, it is $20000 minimum for the first year and $50000 if you want to ensure the service for a few years.

Business Angels platforms are the most suitable and you could raise a lot of funds thanks to it. But still, you have to invest in having a high-quality presentation video or material.

In an early phase, crown funding is also a great option.

Profitability

Ads could be interesting in some cases, but the number of views must be very high to make the service profitable. That’s why ads are usually not suitable for AI Web service, as the high processing cost cannot be compensated by them. They could be compensated only thanks to embedded video ads.

Like many modern SAAS, the best option is often a free few tries and a monthly or yearly subscription proposal. In general, about 1% or 2% of visitors would pay a monthly subscription, depending on the service attractiveness.

Most models can be tuned with parameters and could add value to the service. Making the service profitable means finding innovative ways to tune the model and increase customer interest.

Models also need to be improved continuously to remain competitive and catch new customers. Therefore, customers’ feedback should be completely taken into account in your AI Web service: even if the feedback is not useful in the present, it will probably be the case in the future. As a consequence, your solid business model should include a continuous model improvement strategy.

The best setup for profitability is video ads for free accounts and subscription plans.

For more information see the article AI Web service profitability.

The use of other AI Tools

If we want to stay competitive, we must use competitive tools; today, most of them are AI-based.

ChatGPT is one of them, and we can improve many things just by asking questions about coding, marketing, hardware, etc.

There are also other great tools for marketing, SEO, logo creation, etc.

Just type “AI Tool” + the field you want on Google or Bing to know the current tools.

Marketing

There are several modern ways to announce your AI Web service:

  • Automated chatbot in social networks to answer specific people who might be interested, overall if the service is based on NLP.
  • Most newspapers are willing to publish the latest technology trends, and any new AI Web service is welcome.
  • Social media influencers.
  • Ads services.
Marketing is not trivial for AI web services. You have to deal with profits, hardware costs and model improvement. Image by the author.

AI Web service data has in general more value than standard SAAS. The more you collect data, the more you can improve your model and the more you can improve your return on investment with lower hardware requirements and better customer satisfaction.

Collected data & feedback can improve your model quality and hence decrease hardware cost and increase revenue. Image by the author.

Consequently, investing in marketing from the beginning to mainly increase traffic could be a very good strategy. AI Web service is much more complex than standard SAAS but more flexible and dynamic.

The results could be very different in different regions or states if your service is available worldwide. Feel free to invest in many countries to see which ones have the best result, balance the traffic in different time zones for optimal GPU usage, and improve your numbers.

From a branding point of view, you should put forward all positive points of your service, highlighting a good privacy policy because there is still some mistrust when people deal with artificial intelligence. High quality of service means today high security and a high privacy policy. All advantages should be presented as much as possible, reducing potential fears.

To make a new service known to the public, ads have a high marketing cost (at least 10 000$ per year). Still, you can find cheaper alternative solutions like contracting a marketing freelance or making viral videos on social platforms.

Remember that Ads companies have great analytics tools that would give useful information to improve your business. I have done several ad campaigns; the worst ad I have done, from my point of view, was the one with the most clicks. So don’t hesitate to explore a few ads services with different ads to build the best strategy progressively.

In addition to ads, you should invest in Search Engine Optimization (SEO). Your AI tool should appear in plenty of articles, videos, tweets, or pictures on many platforms to increase your website visibility. The best solution is to have articles or backlinks about your AI Tool on other web pages with a high Domain Authority or a Trust Flow.

You can add your tool to well-known ai tools websites and increase your SEO ranking:

https://www.futurepedia.io/
https://www.thewarehouse.ai/
https://theresanaiforthat.com/

SEO tools like Semrush or SERanking are great for knowing the service positioning in the search engines and how it progresses compared to the competitors.

Photo by Kevin Jackson on Unsplash

Competitors

Whatever your AI business is, you will always get competitors, even if you are a pioneer. The good news is that AI still is a niche area and many opportunities exist, even for small companies. Nevertheless, the competition is never balanced: some companies could receive millions from investors, whereas others don’t have money but talent. That’s why we enter into an Art of War phase, where many different factors play with high complexity. This complexity is terrific and fun because bad decisions could end your business, but good ones could lead to a competitive advantage. “Play smarter, not harder” is generally a good rule in dealing with competition.

After framing the aimed customers, another rule is understanding people’s needs and adapting the service accordingly. It requires a lot of user feedback and communication. Here are some needs that people value the most:

  • Simplicity. Most people are uncomfortable with IT, and having a straightforward service is clearly a competitive advantage. AI is quite a novel technology, and its access should be eased as much as possible.
  • Usefulness. The more the service is helpful, the more interest it gets. Understanding the different use cases and detecting new ones would lead to better user acceptance.
  • Aesthetics. A great design and a service that delivers beautiful results are always appealing. It also gives more confidence to the users because they see the company has invested a lot in its image and therefore deserves attention. Here are some examples of great designs.
  • Quality. Even if AI results are not perfect in many cases, all AI services should improve their results continuously. Eventually, AIs would probably give one or several excellent results, and we should aim for this objective.
  • Security. Some big AI companies had securities scandals that were difficult to eliminate. Not considering people’s need for security and confidentiality could lead to irreversible damage.

You can see how the competition is ranked thanks to services like Similar Web.

Reusability

An AI web service development is very difficult, but the highest the stakes, the better the lessons and the success chances you get.

Indeed, there is no useless experience in building an AI Web service. Actually, it’s quite the contrary! Once you finish an AI Web service, many components could be easily reused for new projects and greatly reduce their time to market. So even if the first AI Web service results are not as good as expected, you still have great advantages regarding reusability and skills learned from this experience. They also increase success chances for future projects or jobs.

Conclusion

AI Web service is now possible thanks to cloud platforms and powerful hardware, but it requires a very good business model to be profitable enough. That’s why, constant model improvement is necessary, in addition to creativity by using model parameters or innovative marketing approaches in a dynamic way. This higher complexity makes AI Web service more challenging but also more interesting. The AI web services winners will be the ones that have not only a good model, but also good design, profitability, security, marketing, hardware, and improvement strategy.

--

--

Nicolas MARTIN
Nerd For Tech

Full Stack Data Scientist. Topics: Deep learning, mathematics, manufacturing engineering, history. Creator of https://www.airoomstyles.com