# 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.

Canonical URL: https://thecompanybrain.com.br/en/articles/what-is-an-algorithm-ai
Authors: Luiz Gardelin
Updated: 2026-11-27T00:35:41.464Z

![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.](https://thecompanybrain.com.br/api/media/file/recurso-o-que-e-algoritmo-ia-1.webp)

The Company Brain, site thumbnail

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](/en/glossary/artificial-intelligence) lies in how those instructions are made. In some systems, a person writes the rules. In today's AI, a [training](/en/glossary/model-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.

## Key points

- An algorithm is a finite sequence of instructions that turns an input into an output, like the review of an expense claim that approves, returns, forwards or rejects the claim according to defined criteria.
- Today's AI uses training algorithms that adjust a model from examples, so the decision criterion comes from the data and not from rules written by a person.
- In a rule-based algorithm you can point to the line that produced the decision; in a learned model the criterion is not written anywhere and only shows up when you compare results across groups of cases.
- Algorithmic bias enters a model mainly through its training data, as in Amazon's recruiting system that learned to penalize women, and Brazil's General Data Protection Law gives people affected by an automated decision the right to request a review and to know the criteria.
- Before using a tool that classifies, scores or recommends, ask the vendor where the criterion comes from and compare a sample of results with your team's assessment, broken down by group of cases.

## 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](https://www.ibm.com/br-pt/think/topics/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](/en/glossary/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.

| Criterion | Rule-based algorithm | Model learned from data |
| --- | --- | --- |
| Who defines the criterion | A person writes each rule | A training algorithm adjusts the model from examples |
| Where the behavior comes from | From the code and the documentation | From the training data and the choices of whoever trained it |
| Explaining a decision | You can point to the rule that produced the output | In general, you can only estimate which factors weighed in |
| A new, unanticipated situation | Falls into a generic rule or produces a visible error | Produces an answer anyway, sometimes wrong but with a correct appearance |
| When the behavior changes | When someone changes the rule | When the model is retrained or the input data changes profile |
| How to check it | Test cases that trigger each rule | Compare a sample of results with people's assessments, by group of cases |

The AI assistants used at work, such as [ChatGPT](/en/glossary/chatgpt), Gemini, Copilot and [Claude](/en/glossary/claude), sit on the right side of the table. They run on a [large language model](/en/guides/what-is-an-llm), 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](/en/articles/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.

| Area | Example with written rules | Example with a learned model | Most common error in the learned model |
| --- | --- | --- | --- |
| Finance | Collection schedule by days overdue | Prediction of which customers will pay late | More errors for customers whose profile is rare in the history |
| Human resources | Résumé filter by required degree | Ranking of résumés by similarity to past hires | Repeating the company's past preferences |
| Customer support | Routing by keyword in the subject line | Urgency classification from the message text | Underestimating messages written differently from the average |
| Sales | Discount by volume band | Scoring of opportunities most likely to close | Favoring the type of customer the team already served |
| Operations | Purchase order when stock falls below the minimum | Demand forecast by product | Errors after market changes that are not in the history |
| Office work in general | Document template with fixed fields | Meeting summary or email draft by an AI assistant | Making up information or leaving out a decision |

The human resources example has a well-known case. An [academic thesis from Universidade São Judas](https://repositorio.animaeducacao.com.br/bitstreams/36e168e0-de6c-4417-b9b9-da50e4c0b586/download) 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](/en/glossary/training-set) and the choices of whoever prepared that data. Our glossary entry on [algorithmic bias](/en/glossary/algorithmic-bias) brings together the definitions from Google and NIST and shows how to scope an investigation.

An [explanation published by Confidata](https://confidata.com.br/blog/vies-algoritmico-discriminacao-lgpd) 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](/en/glossary/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](/en/glossary/personal-data), and it requires whoever decides to disclose the criteria used. [Article 20 of the General Data Protection Law (LGPD)](https://lgpd-brasil.info/capitulo_03/artigo_20) 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](https://repositorio.animaeducacao.com.br/bitstreams/36e168e0-de6c-4417-b9b9-da50e4c0b586/download) 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)](https://www.idp.edu.br/blog/direito/artigo-20-lgpd-revisao-decisoes-automatizadas) 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](/en/articles/evaluate-ai-answers-company) and on [human oversight of AI for each type of task](/en/articles/human-oversight-ai-company) 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](/en/services/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](https://thecompanybrain.com.br/en/contact).

## Sources

- [O que são algoritmos de aprendizado de máquina? (What are machine learning algorithms?)](https://www.ibm.com/br-pt/think/topics/machine-learning-algorithms): Definition of algorithm and model and the contrast between rule-based techniques, programmed explicitly, and machine learning. Technical text by a vendor, in Portuguese.
- [Artigo 20: Direito de revisão de decisões baseadas em tratamentos automatizados de dados pessoais (Article 20: right to review automated decisions)](https://lgpd-brasil.info/capitulo_03/artigo_20): 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.
- [O Direito à Revisão e Explicação de Decisões Automatizadas (Art. 20 da LGPD) (The right to review and explanation of automated decisions)](https://repositorio.animaeducacao.com.br/bitstreams/36e168e0-de6c-4417-b9b9-da50e4c0b586/download): 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.
- [Artigo 20 da LGPD: A Revisão de Decisões Automatizadas Funciona? (Does the review of automated decisions work?)](https://www.idp.edu.br/blog/direito/artigo-20-lgpd-revisao-decisoes-automatizadas): Analysis of the lack of definition of how and by whom the review should be done. Opinion piece, in Portuguese.
- [Viés algorítmico e discriminação: implicações da LGPD e como mitigar (Algorithmic bias and discrimination)](https://confidata.com.br/blog/vies-algoritmico-discriminacao-lgpd): Used only for the classification of types of bias (historical, representation and measurement) and the postal code example. Company blog, in Portuguese.

## Related reading

- [What is an LLM: how large language models work and where companies use them](/en/guides/what-is-an-llm)
- [What is AI hallucination and how do you recognize a made-up answer?](/en/articles/ai-hallucination)
- [Machine learning](/en/glossary/machine-learning)
- [Algorithmic bias](/en/glossary/algorithmic-bias)
- [How do you evaluate the quality of AI answers in your company?](/en/articles/evaluate-ai-answers-company)
- [Organizational AI assessment | The Company Brain](/en/services/organizational-ai-assessment)
