When and How to use AI Solutions in your Product?
Tags: ai, machinelearning, algorithms, productivity
Published: 2022-12-19 14:43:34

## Logical Questionnaire

In order to objectivize the discussion from our archaic feelings of fear and hope that the human brain is deeply attached to, I have created a little questionnaire script in Python below. I don’t expect this to add perfect reasoning to a discussion, or to be followed religiously like a perfect sermon, and neither should you. But it is better to discuss based on a logical system when there is no underlying reasoning mechanism. You can change the words like engineer in the questionnaire to artist to get the insight you want in your own industry. At the end of this blog post, I will share a potential AI use-case example we can use in [SerpApi](https://serpapi.com/).

{% embed https://replit.com/@EmirhanAkdeniz1/WhenandHowtoUseAI %}

## Why implementing AI is important?

It is often hard to decide if a solution including artificial intelligence in your product is necessary or not. In my observations, there seem to be three groups involved in such situations. There are extreme conservationists who despise hearing any related words like machine learning, predictive deep learning, neural network, etc. The other extreme group is the hype-driven people who don’t fully get the implications of how AI technology might create a deficit in a sector. The third party is a party of the middle way, acting on the potential for the future while keeping market reality in the back of their minds, or simply put, optimizing opportunity cost.

I don’t think any of the three groups is an antagonistic group. I think for a functioning evolution of any technology, all three groups are necessary parts of the overall discussion. But the critical part that I need to stress is the discussion. Without feedback and discussion, the first group wouldn’t be able to defend whatever it is they have to conserve since it is also a product of discussion. Without proper feedback from a discussion, the second group would not be able to follow new AI apps and new kinds of automation opportunities, only science fiction magazines. If there wasn’t this contrast between the former two groups, the middle way wouldn’t be able to comprehend what potential is exponentially beneficial or detrimental.

Ten years ago, we didn’t have that much use for AI tools in our life. Now, we have bots trading on algorithms trained on big data sets, chatbots that harness the lead generation whenever human labor is short, real-time natural language processing (NLP) for video content, self-driving cars, proactive disease detection in healthcare, learning algorithms for cybersecurity enhancement, better speech recognition algorithms for virtual assistants like Apple’s Siri or Amazon’s Alexa, etc. We also didn’t have potentially harmful technologies like deep fakes provided by advancements in computer vision, social media, and e-commerce consumer behavior forecasting algorithms, predictive analytics for criminology that could possibly harm the privacy of individuals, image recognition using public CCTV on ethnic minorities, and many more dangerous use cases. There is one fundamental element that brought all of these ai systems into our daily life though, and that is discussion.

Today, we can see that even in the most conservationist company cultures, at least one vital artificial intelligence technology is implemented. Also, in companies with hype-driven cultures, we can see that a decision-making mechanism must do its best to meet real-world customer demands with great care in order to survive in their sector.

Also today, we are in a different age where large models are served via APIs in an easy to implement commands, breakthroughs are being achieved every couple of months, and the pricing is getting democratized while the user experience and applications of AI are improving. The advancements in data science and computer science are also allowing almost anyone to make open-source research on AI. In my humble opinion, this process is bringing us to a dawn of new potential. Today, we are close to creating complex problem-solving ai-algorithms at the individual level like in no time in history before us. I think the companies that have the optimal levels of AI integration in their culture will get large benefits in a competitive market.

In my personal observation, it is easier to create a meme pointing to a flaw in a large model. It is not only easier, but it is also popular. We, human beings are social beings. So when someone grinds hard to give us a large model, we look around and see a GTA-themed whacky world that is mocking everything and anything it can. I’m not saying they are wrong. But they are what they are. The optimal first reaction should be a consideration for a tweak in order to make it work for your use or seek a potential future where you can use it without putting million years as an error in your prediction. Even then, one needs to be careful about the fake feeling of glory in waiting for better conditions. Also in regard to archaic feelings of human beings, it is wise to remember that we have evolved in various conditions that lead us to make decisions when exposed to certain conditions. So, even though logical ground could alleviate the suffering of explaining every permutable detail to the other party, the channel for discussion could be blocked from the start. 

## An Example of a Possible Use of AI

I will use the questionnaire to check if our company needs any AI solution, when it needs it, or how the solution should be implemented.


- Does it take time for engineers to report bugs in your feature?

Yes, At [SerpApi](https://serpapi.com/), we constantly check for bugs, and prevent possible bugs to arise in the code via a thorough reviewing process. Our engineers are constantly looking for bugs within the features we serve.

- Does it take time for customers to report bugs in your feature?

Yes. Although we try to take proactive measures to handle bugs, sometimes we get reports from our customers.

- Does it take some time between bug reporting and fixing the feature of your service that affects the productivity of the customers?

No. It must cause some kind of disruption. But I cannot say it is a production-level disruption since we are trying to solve the problems swiftly.

- Do you have some kind of automated maintenance system that takes less engineer intervention for the feature?

Yes. We are a test-driven company. This means that every time we fix something or support a new feature, it comes with its own unit tests. So anytime we work on something else in the same feature, we are exerting safety by testing that the previous actions are not nullified as much as we can.

- Does the customer demand a PRECISE solution for that feature?

Yes. Most of our customers demand the precision of the data we provide so that they have a good basis.

- Does the customer demand a CHEAP solution for that feature?

Yes. The price point for the service taken plays a major role for most of our customers as it is a vital part of a free competitive economy.

- Does the customer demand a FAST solution for that feature?

Yes. Speed plays an important role, especially in real-time data. Most of our customers demand fast response times from our service.

- Does the AI solution provide a more or equally PRECISE result than the feature of your service?

Yes. The scope I would like to take is parsing. Large LLM models like GPT-3 have become precise enough to do what an HTML parser does. Some limitations such as token size, and noise when dealing with a large corpus should not be considered a problem of precision. It is because it falls under the category of speed. You can always redefine the scope of a prompt and get better results in multiple calls.

- Does the AI solution provide an INEXPENSIVE result than the feature of your service?

No. For most of our features, even a finetuned model of the previous generation cannot compete with our price point. For more information, you can check [SerpApi Pricing](https://serpapi.com/pricing).

- Does the AI solution provide a FASTER result than the feature of your service?

No. The tradition behind HTML parsing is present in antiquities of the internet era. The speed at which we parse HTML is not even worth comparing to large LLM models served via external APIs. You can check out [SerpApi API Status](https://serpapi.com/status) to get information on average response times for deeply filled JSON results.

- Is the AI solution EASY to maintain than the feature of your service?

Yes. Today, it is quite easy to implement AI in some way to support or replace parsing, and have easy maintenance. The number of errors you might encounter is way less in an AI solution, especially in supportive mode.

On top of these points, consider the following scenario:
You have 10 keys you need to scrape and serve. There is a bug in your traditional parser that you haven't realized and finalized for 2 weeks.
You also have an AI parser where you can extract 9 elements from the same body you need to scrape and serve, and 1 key is giving a fuzzy result here and there. This means, your AI parser was at 90% precision whereas your traditional parser was at %80 precision.

So giving fuzzy results is not a sign of trouble all the time when you compare it with traditional methods. But if you can help with the maintenance of the traditional parser with the AI parser, you can buy the time you need to look for a subtle issue in those 2 keys. Overall, the 80% precision throughout 2 weeks will be increased.


- The Results

```
It takes time for both your engineers and customers to report bugs.
Your team is using an automated system to maintain the feature. Customers are happy with which speed of bug resolution.
The Customer demands PRECISION, INEXPENSIVENESS, and SPEED from the feature, and the feature is EASY to maintain.
AI Solution is better at MAINTAINABILITY, and PRECISION. AI solution is worse at PRICE, and SPEED.
You can use the precision of AI as a supportive tool for tasks such as bug reporting or maintenance to enhance your current feature.
```

These are the results that the logical arguments have led us to. As you can see, the suggestion is not to replace the current feature or serve it as a separate feature. It is because AI cannot provide the inexpensiveness and speed the customer is already demanding. It is better to use it as a supportive tool for bug detection though. This way, there is no safety risk coming from customer demand. Overall it is aiming to satisfy the demand for precision more, and take less time from customers and engineers in the process.

## Proposition for an AI Bug Reporting Bot

I propose that if we can implement an AI bug detection tool that is easy to maintain, we can reduce the time taken in reporting bugs by a good margin.

Here is the basic theoretical layout of such a tool:

- The tool takes the main HTML elements we parse in individual parts

- A call is made to one of the SERP Engines of SerpApi.

- The JSON response from SerpApi which the element in interest is collected.

- The raw HTML is taken from the SerpApi endpoint.

- The raw HTML is being used in a prompt to generate a JSON response in the same schema as SerpApi.

- Individual JSON responses are compared.

- If there is a difference in one of the keys, an automated bot reports a possible issue in [SerpApi Public Roadmap](https://github.com/serpapi/public-roadmap/).

I am grateful to the reader for their time. I will share the details of such a project if we decide to implement it.