Pattern learning
The problem
Expense qualification follows precise tax rules, but also choices specific to each company:
- pro/personal split of a phone;
- categorization of a recurring supplier;
- tax treatment of a type of expense.
These are decisions that repeat themselves.
Without learning, the agent asks the same questions for every invoice from the same supplier.
The solution: two levels of rules
Factory rules
Predefined tax rules, drawn from the BOFiP and accompanied by their legal references: a manager’s meal taken alone at the standard rate, fuel deductible according to the engine type, public transport with no recoverable VAT. These rules are immutable, versioned and updated with the product.
Learned patterns
Choices that Simon remembers, by supplier and category:
TOTAL + fuel → 80% deductible, recoverable VAT
landlord + rent → 20% deductible, non-recoverable VAT
ORANGE + telecom → 50% deductible, recoverable VAT
The qualification flow
flowchart TD A[Document ingested] --> B{Existing pattern?} B -->|Yes| C[Apply silently] B -->|No| D{Factory rule?} D -->|Without validation| E[Auto-qualify] D -->|With validation| F[Propose to the user] D -->|No| G[Manual qualification] F --> H{Confirms?} H -->|Yes| I[Qualify + remember]- Pattern found → silent qualification (no question)
- Rule without validation → automatic qualification (fuel, transport…)
- Rule with validation → proposal then learning
- No rule → manual qualification
Obsolescence detection
When a factory rule changes (an update of the legal rates), Simon detects that the existing patterns use a rate different from the new default rate and proposes the update.
Why this design
Repetition is the norm
The same suppliers come back every month. Learning eliminates the repetitive work.
Corrections improve the system
Each manual correction is remembered. The system becomes more accurate with use.
Traceability is preserved
Each qualification carries the trace of its source: tax rule, learned pattern, agent decision, or manual choice. You can always understand why a document was qualified in a certain way.