Personal learning
The layer of meaning under enterprise agents
Notes from studying ontology, knowledge graph, semantic layer and context layer on my own time, with a worked example for each idea. I expect to revise them.
Scope. This is personal learning. I do it on my own time, with synthetic data, to learn and experiment. It is not work for any company or client, and the views are my own. Where I name a domain, it is an illustration.
Why I'm studying this
An agent answers fast. The meaning decides whether it is right.
In 15 years of enterprise systems I've seen the same four things in most of the companies I've worked with. None of them is new. Agents make each one matter more, because an agent answers with confidence whether or not the meaning underneath is settled.
Every system spells the business differently
Customer, order and margin mean something different in each system. Reconciling them takes years.
One metric, two numbers
Two dashboards show the same metric with different values. The meeting starts with whose number is right.
The definitions live in a few heads
The real rules are known to a handful of people. When one of them leaves, the meaning leaves too.
Then the agents arrive
They answer at once, on top of all of the above. Speed without meaning produces the wrong number faster.
The vocabulary
Six words, and the question each one answers
People use these names as if they were one thing. Learning to tell them apart was the first useful step for me.
What exists, how may it relate, and what must always hold?
A substitute may be offered only when it contains no allergen the customer has declared.
Are these two names the same thing?
In this example, two systems use different names for the same product identifier, and the mapping is declared. A brand name is linked to its ingredient, not equated with a drug: RxNorm names a clinical drug by ingredient, strength and dose form.
What is true about this particular thing, and what is it connected to?
This product contains oats and belongs to this group of substitutes.
How is this number computed?
Weeks of supply is on-hand units divided by average weekly units sold over the trailing four weeks.
What should this agent see right now?
The inventory agent gets the stores in the caller's region, and the definitions for inventory and promotions only.
Where does this concept live in the data?
The concept Store maps to one table, and its identity to one key column.
One question
A single question, walked through the layers
This is how I picture it. The example is a retail question on made-up data. Select a step to see what each layer adds. The model handles the language at both ends.
The questionWhich stores are below two weeks of supply on items in an active promotion?
Step 1, context layerDecide what the agent may see
The person asking is a regional inventory analyst. The agent should get the definitions for inventory and promotions, and the stores in that person's region. It shouldn't get anything else.
asking a regional inventory analyst topics inventory, promotions data stores in that person's region left out supplier cost, other regions
Step 2, ontology and terminologyWork out what the words mean
"Stores" and "items" are concepts the business has defined. In this example the merchandising system and the store system use different names for the same item identifier, and that mapping is declared rather than guessed. "Active promotion" has an exact meaning that someone wrote down, so the agent doesn't have to guess either.
stores the concept Store items the concept Item (product_id = item_no, declared) active promotion approved, and running today link a promotion applies to items
Step 3, semantic layerCompute the number the agreed way
"Weeks of supply" is defined once, by the planning team that owns it. The dashboards and agents that read it get the same number.
metric weeks of supply
formula on-hand units / average weekly units
sold, trailing 4 weeks
level store and item
owner the inventory planning team
Step 4, data platformRun it with the caller's access
The query runs on the data platform the company already has, with the access of the person who asked. The rules that already limit what that person can see still apply.
runs on the existing data platform access the caller's own reads inventory, sales, promotions filter active promotion, weeks of supply < 2
Step 5, answerAnswer, and show where it came from
The model writes the answer in plain language and says which definition and which data produced it. If a word in the question had been unclear, the right output would have been to say so.
answer the stores, with weeks of supply for each
based on the definition of weeks of supply,
the meaning of active promotion
if unclear say which word, and ask
What I think so far
Four things I've come to believe
Each of these started as a question, and each comes with an example of the kind I try in practice experiments. I expect to revise some of them.
People write the meaning.
A model can suggest concepts and mappings from documents and schemas in minutes, and that help is real. A model can propose "active customer" from a schema in about a minute. Deciding whether a return inside thirty days still counts is an afternoon for the person who owns retention. That afternoon is the work, and every definition needs someone like that named on it.
Exact conditions need declared relationships.
"Patients on a beta blocker in the last 90 days" has a drug class and a date window in it. Similarity finds notes that mention beta blockers, including the ones that say a drug was stopped. Which drugs are in the class, and what "last 90 days" is measured from, are relationships somebody declared, and the answer depends on them.
What an agent sees should follow permissions.
The inventory agent acting for a regional manager gets that region's stores and the inventory definitions, nothing else. If the same request can be replayed for another caller and the difference checked afterwards, that is a context layer. If it can't, it is a long prompt.
Definitions change, so treat them like code.
When "net sales" moves to exclude marketplace fees, every report on the old definition keeps running and the two numbers drift apart quietly. A proposed change, a review by the person who owns the meaning, and a version number make the switch visible, the same way a code change is.
How I practice
Small experiments, with the answers planted first
Reading only gets me so far. To learn whether an idea holds, I try it on a small set of made-up data where I already know the right answer.
How I set up a practice experiment
- I write the question first, in the words a person would use.
- I generate a small synthetic dataset. No real data is involved.
- I plant the right answers, and some near misses that fail one condition, before anything runs.
- I run a plain retrieval approach and a grounded approach on the same data.
What I record
- What each approach got right and what it got wrong.
- What it cost in tokens and in time. Grounding isn't free.
- When it declined to answer, and whether it should have.
- That the data is synthetic, next to every number.
Open standards
The standards underneath these ideas
None of this is new. Most of it rests on open standards that have been stable for years. These are the documents I'd start from.
How a drug terminology keeps ingredient, strength, dose form and brand apart, with declared links between them.
RxNorm Overview, U.S. National Library of Medicine
Open questions
What I haven't worked out
These are the ones I'm studying now. If you've solved one of them in production, I'd like to learn how.
How much can a model draft?
A model can propose concepts from documents in minutes. Review still takes a person hours. I want to know where the drafts save time and where they add review work.
When is a graph worth it?
For many questions an ontology and a semantic layer seem to be enough. A graph helps when the answer needs a path. I don't yet have a test that tells the two apart in advance.
How should declining be tested?
Testing right answers is well understood. Testing whether an agent declined when it should have is less so, and I haven't found a method I trust.
What changes when agents act?
Everything on this page is about reading. When an agent changes something, the questions are about approval, reversal and ownership. I've only started on those.