David Krause Knowledge Base · AI in cost accounting
Topic AI in cost accounting Book ref. Ch. 18 Edition 07/2026

Local language models in cost accounting

How a 0.5-billion-parameter model on an ordinary office PC assigns DATEV posting texts to the right cost types — and why the interesting part isn't the model but the architecture around it.

~300 MB
model size after quantization
8 %
share the model even sees
€0
cost per query · fully local

This article describes the technical implementation behind the cost-abstraction mapper — the tool that transfers a DATEV trial balance into the 24 nodes of the cost-type plan. It is aimed at technically interested readers; to use the tool itself you need to know none of this.

1 · The problem: posting texts are chaotic

Posting texts arise in day-to-day work — without a scheme, without uniformity. The same matter is described completely differently by different people. This is exactly where classic keyword search fails:

One matter, five spellings
Posting texts as writtenIntended cost type
"Regrind cutter 12mm" · "cutter grinding" · "tool reconditioning" · "grinding solid carbide" · "tool repair cutter"Consumable tooling node 05
"Electricity hall" · "energy Nov." · "power consumption" · "power+heat" · "gas heating production"Energy costs node 07
"Maintenance machining center" · "maint. machine" · "rep. CNC milling" · "maint. turning center"Maintenance node 08
"Salary supervisor" · "wage setter" · "pay shift leader" · "remuneration production management"Indirect wages/salaries node 06

Language models are built for exactly this kind of variation. The obvious solution would be to send every posting line to a large cloud model. For accounting data, though, that is the worst of all options — more on that shortly.

2 · The architecture: rule before model

The most important design principle is: the language model is the last resort, not the first. Every posting line passes through three layers and leaves the system as soon as an assignment is settled.

1
Account-number lookup (deterministic) SKR03 account 4110 → always direct labor. A fixed 1:1 mapping for all known accounts. No model, no chance, verifiable at any time.
~75 %
2
Posting-text rule set Over 200 keyword rules: "regrind" → tooling, "trade tax" → neutral, "maintenance" → upkeep. Covers the most common phrasings.
~15 %
3
Language model with confidence threshold Only what remains goes to the fine-tuned model. If confidence is below 85 %, the line is flagged for manual review rather than guessed.
~8 %
Why this order decides everything

Nine of ten lines are handled by rules you can read, check and correct. The model only processes the difficult remainder. That keeps the share of the system that stays fundamentally unexplainable small and bounded — and an error in the model can only distort the overall result to a limited degree. Whoever works the other way around and hands everything to the model has built a system whose results they can no longer justify. In cost accounting, that is disqualifying.

3 · Why a small model — and why local

For the task "assign a short German text to one of 24 categories" you don't need a model with hundreds of billions of parameters. A compact model of the 0.5-billion class (in the prototype: Qwen2-0.5B, openly licensed) is enough once it is fine-tuned for the task. The advantages are considerable:

CriterionLocal 0.5B modelCloud model
Data outflownone — runs offlineposting data leaves the building
HardwareCPU, under 2 GB RAMnone of your own needed
Cost per query€0.00API fee per line
Availabilityindependent of network and providerdependent on both
General language understandinglimitedmarkedly better
Fine-tuning on own datapossible, low effortusually not possible

The data-protection point is not a side issue. A trial balance contains salary totals, supplier relationships and margin data. Transmitting it to an external service raises data-processing questions that simply don't arise when the processing never leaves the machine.

4 · LoRA: fine-tuning without a data center

A base model does not know cost accounting. It has to learn that "regrind" belongs to node 05 and "trade tax" to the neutral abstraction. The classic route would be to retrain all model weights — expensive and unrealistic for a small team.

LoRA (Low-Rank Adaptation) takes a different path. The original weights stay frozen. Instead, small additional matrices are trained that sit alongside the existing layers and shift their behavior. The mathematical trick: this adjustment can be represented as the product of two very narrow matrices — instead of a full matrix with millions of entries, two with a few thousand suffice.

The principle in one line W' = W0 + B·A   with A ∈ ℝr×k, B ∈ ℝd×r, r ≪ min(d,k)

W0 stays unchanged — only B·A is trained

Practical consequences: training runs on an ordinary graphics card instead of a cluster. The result is an adapter of a few megabytes, not a whole new model. And you can keep several adapters for different tasks on hand and load them by context — the same base model, different specializations.

The training data is the real work

The demanding part is not the training but the labeling: every historical posting text needs the correct cost type and BAB column — following the same allocation rules a human applies. Whoever works sloppily here trains in their own errors. A model is only ever as good as the system you show it.

5 · Quantization: from gigabytes to megabytes

A trained model usually stores its weights as 16- or 32-bit floating-point numbers. For the classification task, that precision is waste. In quantization, the weights are mapped to coarser number formats — often 4 bits per weight, block-wise with their own scaling factors so the error stays small.

FormatBits/weightSize (0.5B model)In practice
FP16 training format16~1.0 GBreference for quality comparisons
INT88~0.5 GBquality loss practically unmeasurable
Q4 4-bit, block-wise~4.5~300 MBproven compromise for CPU operation

The effect is twofold: the model fits into the memory of an ordinary office PC, and it gets faster — because at these model sizes the bottleneck is not compute but memory bandwidth. Fewer bytes per weight directly means shorter response times.

6 · ONNX: decoupling the model from the training framework

A model is developed in a training framework but is meant to run in an application — ideally without that application dragging the entire training environment along. ONNX (Open Neural Network Exchange) is a vendor-independent exchange format: the trained model — including the merged-in LoRA adapter — is exported as a computation graph and executed by a lean runtime.

For a tool meant to be installed at a company, this is the decisive step toward maintainability: one model file, one runtime library, no Python dependency chains that break at the next update.

Assessment

7 · What the system does — and what it doesn't

On a validation set of 80 posting lines not contained in the training, the prototype achieved the following values:

MetricResultMeaning
Hit rate93.7 %75 of 80 lines assigned correctly
Avg. confidence87.3 %basis for the 85 % threshold for manual review
False-neutral rate0.0 %no real cost item wrongly excluded
How to read these figures

80 examples are a proof of function, not a robust statistic. The data set comes from one type of company; with a different account structure or posting practice, the values can deviate markedly. The most meaningful figure is the third anyway: that no real cost item was wrongly classified as neutral matters more than the overall hit rate — because excluded costs are missing from the hour rate later and no one notices.

8 · The limits — and why they should stay

Three things this system cannot do, and for two of them it would be a mistake to try:

The right positioning

The value of this technology is not in replacing the cost accountant but in taking the mechanical pre-sorting off their hands — so they spend their time on the cases that truly require judgment. Whoever starts out expecting the system to take over cost accounting will be disappointed. Whoever uses it as a pre-sorter with a review obligation gains real time.

9 · Effort and benefit — soberly

Building such a system costs primarily time for labeling and rule maintenance, not money for hardware; an ordinary office PC suffices. The time saved in ongoing use amounts, for a monthly abstraction, to a few hours — appreciable, but not an order of magnitude that saves a position.

Robust ROI figures are difficult here: they depend on the number of posting lines, the account structure and how cleanly the work was done beforehand. Whoever presents a three-digit return extrapolates from a handful of assumptions. More realistic is the view that the effort pays off through consistency: an abstraction performed every month by the same rules, with documented assignments, is worth more than a few hours saved — because it is what makes comparability across periods possible in the first place.

This article summarizes the technical chapters from Part VI of the book. The methodological framing remains in the book (Chapter 18); the implementation details are here because they date faster than the cost-accounting part.

David Krause
Industrial engineer (Dipl.-Wirtschaftsingenieur FH) · 15+ years of cost accounting, plant controlling and maintenance in CNC and die-casting manufacturing. Writes down here what has proven itself in practice.
Profile and CV · Knowledge Base · Contact