LATS: Considering several paths simultaneously with AI — and the availability check in SAP B1
30 Sep

LATS: Considering several paths simultaneously with AI — and the availability check in SAP B1

This series focuses on artificial intelligence in conjunction with SAP Business One. Not as a collection of product announcements, but as an attempt to calmly consider fundamental AI principles and reflect on them using an example from everyday ERP use. This time, the topic is one that goes far beyond pure text generation. How does an AI model decide when a task requires not just a correct next sentence, but several steps that build upon each other? The technical term for this is Language Agent Tree Search, or LATS for short.

Read more: LATS: Mehrere Wege gleichzeitig durchdenkt mit KI — und die Verfügbarkeitsprüfung in SAP B1

Key Takeaways

  • The article discusses LATS (Language Agent Tree Search) as an approach to improve multi-step decision-making processes in AI-based applications.
  • Speed is not synonymous with accuracy; an AI agent should consider several alternatives to make informed decisions.
  • LATS enables a tree structure for decision-making processes and combines well-known methods such as Chain-of-Thought and ReAct.
  • In the example of SAP Business One, the availability check lists several solutions, but LATS could expand this with an evaluation phase.
  • The article is aimed at managers and finance managers who want to understand the difference between AI agents and simple chatbots.

Quick is not the same thing as right.

An AI model that simply finishes the first idea works quickly. That’s what you want, right?.

But quick is not the same thing as right. Anyone who immediately implements the first thought that sounds plausible has not yet said anything about its quality. In the case of a promotional text, a single pass may be enough, because the result can be corrected subsequently if necessary. In tasks involving multiple consecutive steps, the same attitude is no longer appropriate.

Why this is more than just a technical question

For managers and finance managers, this is more than an academic question. An AI agent could in the future independently examine order suggestions, compare supplier offers, or address a disruption in an application. The decisive factor is a single decision point: Does the model weigh the various paths against each other, or does it follow the first suggestion blindly? A system that only tracks one path can get stuck in an early misassumption. It does not recognize this misassumption itself. A system that tracks several paths in parallel and compares them has at least one chance. It can leave the wrong path in time.

This applies to many tasks in business, not just software. When planning a delivery date, making a purchase decision, or investigating a flaw in a complex application, you don’t just make a decision; you make several decisions in succession. Each decision depends on the previous one. A single false step is enough to end up with an answer. This may sound smooth, but it misses the real problem. This multi-step structure is precisely what makes pure text generation overwhelming, no matter how powerful the individual language model behind it might be.

A principle that already exists

What is lacking is something very ordinary: weighing the various alternatives. This weighing takes place before a decision is made. People do this constantly, usually without realizing it. When making an important decision in a company, the first thought is not always immediately implemented. At least briefly, one considers the various alternatives. Only then does the choice take place. This very principle can be technically replicated. One only has to know where to look.

It is remarkable that this very balancing act cannot be reinvented in the software landscape. It has long existed, just under a different name and in a different tool. Anyone who works with SAP Business One in their daily operations encounters a function that embodies exactly this principle. No one has ever called it artificial intelligence.

A chess player who plays several moves in his head

A good chess player rarely simply takes the first move that comes to mind. In their mind, several possible continuations arise simultaneously: if they move here, their opponent will likely respond in that way, and this results in a certain position. A second thought of a move leads to another position, a third to another one again. Only after this internal exploration of several possible paths does the player decide on a single, actually executed move.

After the game, the same player often looks back and notes which of the imagined but not played continuations would have been better. This forethought of several paths and the subsequent evaluation of which path would have been worthwhile is essentially nothing more than a tree structure in the mind. A starting point, several branches that depart from it, and at each branch new branches again. This very structure is technically modeled by a process called LATS, only not on a chessboard, but for tasks involving many steps that build upon one another.

When a model not only continues the story but anticipates it

What LATS makes out of Chain-of-Thought and ReAct

The technical term LATS stands for Language Agent Tree Search. It originates from a research paper published in 2023 titled „Language Agent Tree Search Unifies Reasoning, Acting, and Planning in Language Models“. Two already known methods form the basis. Chain-of-Thought allows a model to write down its thoughts in individual steps before a response occurs. ReAct extends this by including actions in an environment, such as tool calls, followed by an observation of the result. How this works in detail is described in a previous post in this series about ReAct and the automatic bank reconciliation in SAP Business One. LATS goes one step further. It no longer organizes these steps in a single sequence, but in a tree structure, complemented by a self-reflection at the end of each run.

The six-stage cycle

LATS - The six-stage cycle

A single round of the procedure takes place in six steps, which are repeated with each repetition:

  1. Selection: Starting from the existing search tree, the process navigates along the branches that have been evaluated best so far to a node at which further searching is carried out.
  2. Expansion: At this node, the model generates several possible next actions simultaneously and performs each of them in its respective environment.
  3. Evaluation: Each newly created action receives a rating value, formed from a model assessment („LLM as a Judge“) and the frequency of similar actions. These actions appear with varying frequency among many attempts.
  4. Simulation: The best-rated new branch will be continued until success, failure, or the end of the available budget.
  5. Backpropagation: The result of this simulation updates the ratings of all the nodes that passed through on the way there retroactively.
  6. Reflection: The model provides a brief linguistic assessment of what went well in the process and what didn’t. This assessment serves as a basis for the next round.

UCT: how the selection between branches works

The selection phase does not decide randomly which branch it follows. A formula called UCT balances two factors: the previously measured value of a branch and the ratio of previous visits. This ratio shows how often a branch has already been visited compared to its neighbors. A branch with a high previous value is preferred. A branch that is rarely visited still has occasional chances. Without this balance, the method would either determine too early a seemingly good but actually weaker branch. Or it would endlessly try new branches without ever going deep enough.

The availability check already knows the principle: only without evaluation

When a user places a customer order in SAP Business One and the ordered quantity of an item exceeds the available stock, the system reacts automatically. It then presents several solution options simultaneously. The user can see four options at a glance. He can still place the order in full and deliver it later. He can also choose only the actually available items. available Plan a partial delivery. Or he orders the item from a different warehouse or switches to a stored alternative item.

This multiple display is structurally close to what LATS does in the expansion phase. Instead of a single action, the system generates several concrete, already-tested options at the same time, from which one is selected. The difference to a simple error message („not enough stock“) lies exactly here: it does not create a dead end, but a small tree of action alternatives.

SAP Business One does not evaluate these options itself and does not select them automatically either. There is no instance in the system that marks one of the four options as „the best“. The evaluation phase of LATS would do this with a scoring value. There is also no backward updating that learns from the output of a case and influences future ads. That is exactly what the backpropagation phase provides. These two steps remain entirely in the hands of the user.

A thought experiment: What if the exam remembered?

What follows is a thought experiment, not an announcement. Such an extension has not been included in SAP Business One so far, but it is certainly conceivable with artificial intelligence.

Today, the availability check shows its four options. As soon as the user has made a choice, the system forgets the case again. An extension would be conceivable that additionally records how a case ended. Did the partial delivery lead to a timely delivery or to a customer inquiry? Did the switch to the alternative item go smoothly, or did a complaint follow? Such an experience could feed into the next display. Options that had performed well in similar cases would be highlighted. Options with a worse experience rating would at least receive a hint.

Such a feedback mechanism would require a standard for what „going well“ actually means. This standard would have to be translated into a number so that a system could even process it. Whether „on time“ alone is sufficient or whether follow-up costs, the complaint rate, and customer satisfaction also need to be factored in would be a matter of definition. This question would need to be clarified before any line of program code. Establishing this standard would be more difficult in doubt than the technology that ultimately processes it.

Who it's worth it for

This article is aimed at managers and finance managers in the context of SAP Business One. It is aimed at anyone who wants to understand the difference between the term „AI agent“ and a simple chatbot. It is also aimed at anyone who is dealing with customer orders, warehouse logistics, or alternative items themselves. For those in their company who do not work with multiple warehouses or with stored alternative items, the example in this text has little relevance to their own practice. However, they can still use it to clarify the terminology regarding LATS.

LATS

LATS: Considering several paths simultaneously with AI — and the availability check in SAP B1

This series focuses on artificial intelligence in conjunction with SAP Business One. Not as a collection of product announcements, but as a…
ReAct and RLEF

ReAct and RLEF: How Artificial Intelligence Learns from Real Mistakes — and What Automated Bank Reconciliation in SAP Business One Has to Do with It

This is the fourth instalment of a series on this blog that deals with AI fundamentals in conjunction with SAP Business One...
Service Layer AI as a transactional layer

SAP B1 10.0 FP2608: Service Layer AI as a transactional layer

The SAP Business One Service Layer has previously served predominantly as a passive data supplier: applications requested data via OData, each …
Process Reward Model

Process Reward Models: Why a correct result does not yet prove a correct method

This series continuously examines individual AI basic concepts and methods, such as the Process Reward Model. The previous episode …
Test-Time-Compute-Scaling

Test-Time Compute Scaling: Why a Smaller AI Model Can End Up Winning — and What Supplier Comparison in SAP Business One Has to Do With It

This is a continuation of the series on this blog, which deals with Artificial Intelligence in combination with SAP Business One ...
RLHF

RLHF and reward models: AI hype or what the approval process in SAP Business One has to do with it

Key Takeaways The article covers the application of Artificial Intelligence in connection with SAP Business One and fundamental AI topics. Thanks to …
Wird geladen …