Skip to content
Book a conversation

What is an algorithm and what does it have to do with the AI your company uses?

An algorithm is a finite sequence of instructions that turns an input into an output. See the difference between an algorithm of written rules and an AI model learned from data, examples from company routines, what algorithmic bias is and how to check results before using them.

Luiz GardelinUpdated 15 min readRead in Markdown
3D illustration on a cream background: a cream tube carries mixed blue, yellow and cream spheres to an orange ring; after the ring, the tube splits into two branches, one with yellow spheres and one with blue spheres, each in a row.
On this pageIntroduction

An algorithm is a finite sequence of instructions that turns an input into an output. In a company, it shows up whenever a system receives a piece of data and returns a decision or a suggestion: the collection schedule that sends a reminder three days after the due date, the system that sorts résumés, the tool that classifies support tickets by urgency. The link to artificial intelligence lies in how those instructions are made. In some systems, a person writes the rules. In today's AI, a training algorithm adjusts a model from examples, and the rules that model follows were not written by anyone. This article explains that difference with everyday examples, shows how to find out what kind of algorithm is behind a tool and how to check its results before acting on them, including when there is a risk of algorithmic bias.

What is an algorithm, with an example from a company's routine?

An algorithm is a procedure defined step by step to reach a result from input data, and any repeated routine with clear criteria can be described as one. Think of the expense claim review done by the finance team:

  1. Receive the claim with amount, date, category and receipt.
  2. If the receipt is missing, return it to the requester.
  3. If the amount exceeds the category limit, forward it to the manager.
  4. If the date is more than 60 days old, reject it.
  5. In all other cases, approve it and schedule the payment.

The sequence has an input (the claim), conditions ("if the amount exceeds the limit") and an output (approve, return, forward or reject). When that sequence becomes code inside a system, it runs without a person, but it is still the same list of steps. Anyone who wants to know why a claim was rejected can open the rule and find the line responsible.

This is the sense in which all software is said to be made of algorithms. The payroll system, the spreadsheet with formulas and the email routing follow instructions written and tested by someone. The word took on another use when it also came to mean whatever decides what appears on a social network or what an AI assistant answers. In those cases the algorithm still exists, but the result depends on a model trained with data.

What is the difference between a rule-based algorithm and a model learned from data?

The difference between a rule-based algorithm and a model learned from data lies in who defines the decision criterion: in the first, a person writes the rules; in the second, a training algorithm finds patterns in examples and stores those patterns in a model. IBM describes this contrast when it explains that machine learning algorithms let the model learn from experience, while rule-based techniques require a specialist to program the decision logic explicitly.

Three terms help follow the explanation. The model is the program that receives an input and returns a prediction or a classification. Training is the process in which an algorithm adjusts the model, example by example, until its answers come close to the expected ones. Labeled data are examples that already carry the right answer, such as emails marked by a person as "spam" or "not spam". The glossary entry on machine learning has more detail on this process.

Back to the expense claim: a learned model would receive thousands of past claims already marked as approved or rejected and work out on its own which combinations of amount, category, requester and receipt text tend to lead to each result. It can get right cases that no rule anticipated. It can also learn criteria nobody meant to teach, such as rejecting more claims from one branch because, in the past, a manager at that branch rejected more.

CriterionRule-based algorithmModel learned from data
Who defines the criterionA person writes each ruleA training algorithm adjusts the model from examples
Where the behavior comes fromFrom the code and the documentationFrom the training data and the choices of whoever trained it
Explaining a decisionYou can point to the rule that produced the outputIn general, you can only estimate which factors weighed in
A new, unanticipated situationFalls into a generic rule or produces a visible errorProduces an answer anyway, sometimes wrong but with a correct appearance
When the behavior changesWhen someone changes the ruleWhen the model is retrained or the input data changes profile
How to check itTest cases that trigger each ruleCompare a sample of results with people's assessments, by group of cases

The AI assistants used at work, such as ChatGPT, Gemini, Copilot and Claude, sit on the right side of the table. They run on a large language model, trained on large volumes of text to predict the next word. That is why they can write something plausible and false, which is called AI hallucination.

Where do rule-based algorithms and learned models show up in a company's daily work?

Rule-based algorithms and learned models show up side by side in the same areas, and many tools combine the two: a model suggests, and a rule decides what to do with the suggestion. The table brings together common examples, described in general terms. The right-hand column shows what tends to go wrong in each case.

AreaExample with written rulesExample with a learned modelMost common error in the learned model
FinanceCollection schedule by days overduePrediction of which customers will pay lateMore errors for customers whose profile is rare in the history
Human resourcesRésumé filter by required degreeRanking of résumés by similarity to past hiresRepeating the company's past preferences
Customer supportRouting by keyword in the subject lineUrgency classification from the message textUnderestimating messages written differently from the average
SalesDiscount by volume bandScoring of opportunities most likely to closeFavoring the type of customer the team already served
OperationsPurchase order when stock falls below the minimumDemand forecast by productErrors after market changes that are not in the history
Office work in generalDocument template with fixed fieldsMeeting summary or email draft by an AI assistantMaking up information or leaving out a decision

The human resources example has a well-known case. An academic thesis from Universidade São Judas reports that Amazon built a recruiting system trained on ten years of hiring in a male-dominated field, which learned to penalize women applying for software development roles. The company abandoned the system. No rule said to exclude women: the model extracted that pattern from the examples it received.

How do you find out what kind of algorithm is behind a tool?

To find out what kind of algorithm is behind a tool, ask the vendor or the team responsible for the system where the criterion for each decision comes from and ask for the documentation of that criterion. You do not need to read code. The questions below separate written rules from learned models and show what you will need to check.

  1. Does the decision follow rules configured by someone or a model trained with data? If they are rules, who can see and change each one?
  2. If there is a model, what data was it trained on? Is the data from our company, from other customers or from public sources, and from what period?
  3. Does the model keep learning from use, or does it only change when the vendor releases a new version? How are we told about the change?
  4. Does the tool decide on its own or present a suggestion for a person to approve?
  5. What accuracy measure does the vendor have, for which kinds of case, and was accuracy measured separately by group (for example, by region, age band or support channel)?
  6. For a specific decision, does the tool show which factors weighed in? Can the cases be exported for review?
  7. When the tool is not confident enough, does it say so or answer anyway?

Vague answers such as "we use advanced artificial intelligence" do not tell you whether there is a learned model or how it was evaluated. Record the answers together with the name of the tool, the area that uses it and the decision it supports. That record shows where the company depends on a model and who is accountable for each result.

What is algorithmic bias and how does it get into a model?

Algorithmic bias is a systematic pattern of error or unequal treatment produced by a system based on algorithms, and in a learned model it usually enters through the training data and the choices of whoever prepared that data. Our glossary entry on algorithmic bias brings together the definitions from Google and NIST and shows how to scope an investigation.

An explanation published by Confidata describes common ways bias gets in. Three of them appear in a company's routine:

  • Historical bias. The examples reflect past decisions, and the model repeats those decisions as if they were a criterion. If the company has always promoted one profile of person, a model trained on those promotions tends to prefer the same profile.
  • Representation bias. A group appears rarely in the data, and the model makes more errors with it.
  • Measurement bias. A variable that looks neutral carries other information. The same explanation cites the postal code, which in many Brazilian cities is related to race and socioeconomic status.

Bias also appears in rule-based systems, when someone writes a criterion that disadvantages a group. The difference is that, in a rule, the criterion is written down and can be found. In a learned model, the criterion does not appear anywhere and can only be noticed by comparing results across groups of cases.

There is also a bias on the side of whoever uses the system. Automation bias is the tendency to accept a system's recommendation without examining it, especially when it arrives ready-made and looks technical. A review that only confirms the tool's suggestion does not correct the model's error.

What does Brazilian law say about decisions made by algorithms?

Brazilian law gives the affected person the right to request a review of decisions made solely on the basis of automated processing of personal data, and it requires whoever decides to disclose the criteria used. Article 20 of the General Data Protection Law (LGPD) expressly mentions decisions that define a person's personal, professional, consumer and credit profile, which includes candidate screening, credit analysis and pricing by profile.

The same article requires the controller to provide, when asked, clear and adequate information about the criteria and procedures of the automated decision, subject to commercial and industrial secrecy. If the company withholds that information on grounds of secrecy, the national authority may carry out an audit to check for discriminatory aspects in the automated processing.

A review by a person is not required in every case. The thesis from Universidade São Judas records that the part of article 20 that required review by a natural person was vetoed in 2019, in the process that led to Law 13,853/2019. An analysis by the Brazilian Institute of Education, Development and Research (IDP) points out that the law does not define how the review should be done or by whom, and that, without regulation, it sometimes amounts to repeating the system's decision.

For the manager of an area, the practical consequence is direct. If a tool makes decisions about candidates, customers or suppliers using personal data, the company must be able to explain the criteria and review a decision when someone asks. That is only possible if someone knows how the tool reaches its result and has the authority to change it. The legal analysis of each case belongs to the company's data protection officer and legal counsel.

How do you check the results of an algorithm before using it in your company?

To check the results of an algorithm before using it in your company, take a sample of cases, ask people who know the task to decide those cases without seeing the tool's answer and compare the two answers, by type of case. The procedure below uses a hypothetical example: the customer support coordinator is about to adopt a tool that classifies tickets as urgent or not urgent.

What you will produce: a review spreadsheet with the agreement rate between the tool and the team, broken down by group of cases, and the decision to use, adjust or not use the tool.

What you need: read access to the tickets, the list of groups that matter to the area (in the example, entry channel and customer region), two experienced team members and about an hour of work from each. Use real tickets only with authorization to process that data; to test the method, create fictitious examples.

  1. Define the criterion for a correct answer. The coordinator writes, in one sentence, what an urgent ticket is for the area. In the example: "risk of stopping the customer's operation or a contractual deadline due within 24 hours". Check that the two people who will assess agree with the sentence before starting.
  2. Build the sample. Export 100 recent tickets the tool has already classified. Make sure each group has at least 20 cases; if the WhatsApp channel has only 5, add tickets from that channel until it reaches 20. Hide the column with the tool's classification.
  3. Ask the team to assess. Each assessor classifies the tickets without seeing the other's answer or the tool's. Where the two disagree, the coordinator decides and notes the reason. The result is the reference classification.
  4. Compare the answers. Bring back the tool's column and mark each row as agreeing or disagreeing. Calculate overall agreement and agreement in each group. In the example, the tool agrees on 88 of 100 cases overall, but on only 13 of 20 WhatsApp tickets.
  5. Examine the disagreements. Read the cases the tool got wrong and look for a pattern. In the example, short, informal messages, common on WhatsApp, are classified as not urgent even when they report the operation has stopped. That is the sign that the model learned from a history in which most urgent tickets arrived by email.
  6. Decide on use. Based on the error and its consequence, choose one of three outcomes: use it as is; use it with a safeguard rule (in the example, every WhatsApp ticket containing the words "stopped" or "down" goes to human review); or do not use it until the vendor fixes it. Record the decision, who made it and the date.
  7. Schedule the next check. Repeat the sample after every update of the tool and whenever the profile of tickets changes, for example after a new channel opens.

Completion test: another person in the area should be able to open the spreadsheet and answer, without help, in which groups of cases the tool makes the most errors, which safeguard rule was adopted and when the next check will be. The articles on how to evaluate the quality of AI answers and on human oversight of AI for each type of task explain how to turn this check into a routine.

The same reasoning applies to AI assistants. In a meeting summary, the sample is the decisions and deadlines, and the reference is the recording or the minutes checked by someone who attended.

How does The Company Brain help you understand the algorithms your company already uses?

The Company Brain starts by surveying the work: we talk with the teams and map which tools decide or suggest something in each area, where each one's criterion comes from and who checks the result. With that map, the company knows where it depends on written rules, where it depends on learned models and where nobody is responsible for review. This survey is part of our organizational AI assessment.

If your area already uses a tool that classifies, scores or recommends and nobody can say how it reaches its result, bring the name of the tool, the decision it supports and an example of a result that looked odd. We can talk about how to check that tool and decide who reviews what it delivers. Schedule a conversation.

Common questions

What is an algorithm?

An algorithm is a finite sequence of instructions that turns an input into an output. In a company, one example is the review of an expense claim that receives the request, checks the receipt, amount and date, and decides whether to approve it, return it, forward it to the manager or reject it. When that sequence becomes code, the system runs it without a person.

What does an algorithm have to do with artificial intelligence?

Today's artificial intelligence depends on training algorithms, which adjust a model from examples until its answers come close to the expected ones. The result is a model that classifies, predicts or generates text following patterns extracted from data, not rules written by someone. Assistants such as ChatGPT, Gemini, Copilot and Claude run on this kind of model.

What is the difference between a rule-based algorithm and a model learned from data?

In a rule-based algorithm, a person writes each criterion, and you can point to the rule that produced a decision. In a model learned from data, the criterion comes from the examples used in training and is not written anywhere. That is why the model answers even cases nobody anticipated, sometimes wrongly but with a correct appearance, and it can only be checked by comparing its results with people's assessments.

What is algorithmic bias?

Algorithmic bias is a systematic pattern of error or unequal treatment produced by a system based on algorithms. In a learned model, it usually enters through the training data, when the examples repeat past decisions, underrepresent a group or use variables that carry other information, such as a postal code. Amazon's recruiting system, trained on ten years of hiring in a male-dominated field, learned to penalize women and was abandoned.

How do you check the results of an algorithm-based tool before using it in your company?

To check the results of a tool, take a sample of cases it has already classified, ask experienced people to decide the same cases without seeing the tool's answer and compare the two, by group of cases. Look for a pattern in the disagreements and decide whether the tool will be used as is, with a safeguard rule, or not at all. Repeat the check after every update of the tool.

What does Brazilian law guarantee to people affected by an automated decision?

Brazil's General Data Protection Law guarantees, in article 20, the right to request a review of decisions made solely on the basis of automated processing of personal data, such as those that define a professional, consumer or credit profile. The company must disclose, when asked, the criteria and procedures used. The requirement that the review be carried out by a person was vetoed in 2019, and the law does not define how the review should take place.

Sources

  1. O que são algoritmos de aprendizado de máquina? (What are machine learning algorithms?) IBM

    Definition of algorithm and model and the contrast between rule-based techniques, programmed explicitly, and machine learning. Technical text by a vendor, in Portuguese.

  2. Artigo 20: Direito de revisão de decisões baseadas em tratamentos automatizados de dados pessoais (Article 20: right to review automated decisions) LGPD Brasil

    Reproduction of the text of article 20 of Law 13,709/2018 (main clause, paragraphs 1 and 2 and vetoed paragraph 3). Unofficial site, in Portuguese.

  3. O Direito à Revisão e Explicação de Decisões Automatizadas (Art. 20 da LGPD) (The right to review and explanation of automated decisions) Universidade São Judas (undergraduate thesis by Giulia Alves Pereira)

    Secondary source used for the 2019 veto of review by a natural person (Law 13,853/2019) and for the Amazon recruiting system case, cited from Exame (2018). In Portuguese.

  4. Artigo 20 da LGPD: A Revisão de Decisões Automatizadas Funciona? (Does the review of automated decisions work?) Instituto Brasileiro de Ensino, Desenvolvimento e Pesquisa

    Analysis of the lack of definition of how and by whom the review should be done. Opinion piece, in Portuguese.

  5. Viés algorítmico e discriminação: implicações da LGPD e como mitigar (Algorithmic bias and discrimination) Confidata

    Used only for the classification of types of bias (historical, representation and measurement) and the postal code example. Company blog, in Portuguese.

Written by

Luiz Gardelin

Founder and lead consultant at The Company Brain

Luiz Gardelin is the founder and lead consultant at The Company Brain, an AI organizational transformation consultancy based in Brazil. He also founded Webinhood and Tropk.ai.

See all content by this author

A conversation about your organization.

Before recommending any tool, we talk with your teams and map how the work really happens.

Arrange a conversation

Related terms

Continue reading

All resources