Learning More From Less

November 27, 202607 min Read

Ontologies, sample efficiency and where an organization's intelligence should live

Most organizations with the problems most worth solving cannot produce the data that training a model assumes. An oil and gas operator does not have ten million labeled pump failures. A bank does not have a million examples of every exception in its loan workflow. What they have is a few hundred good cases, knowledge that lives in people more than in systems, and a hard requirement that the system be right.

One question I keep coming back to is what sample efficiency means for organizations like these. The size of the model matters less than how much the system can learn from each example it sees. My claim is that an ontology lowers the dependency on samples, because it gives the model the structure of the business up front instead of making it rediscover that structure from data.

This piece is also a record of how our own thinking has moved. In the Own the Loop series I asked what belongs in the weights, and we answered by distilling 597 of our own decisions into a small model we own, which reached 0.98 verdict accuracy as an evaluator (Bilal 2026b). That work did what it set out to do, and owning those weights is what let us open the model and name the concepts it judges with. It also showed us where the method stops. A narrow judgment that holds still can live in weights. The facts, rules and judgment of a whole business change too often to live there, and they need a home the organization can read, correct and keep.

Every Example Has a Price

Sample efficiency is how much a system learns from each example. An efficient learner performs well after ten cases. An inefficient one needs ten thousand, because it has to work out the structure of its world from scratch each time.

The practical measure is to count, for a given level of accuracy, the examples you had to pay for. Each one has a cost. Someone has to collect it, clean it and label it, and in a regulated or air-gapped environment, obtain permission to use it at all. Lowering that count lowers the cost, the time to value and the risk of the whole deployment.

People set the standard. A new field engineer does not need a thousand failed pumps to understand that a pump rated for 3,000 psi should not be run at 4,000. Someone states the rule once and the engineer applies it everywhere. Cognitive scientists attribute this to the models of the world people bring to each new problem, and to their habit of building new concepts from parts they already understand (Lake et al. 2017). That is the behavior we want from the systems we build, and it tells us where to look for it: in what the system knows before the first example arrives.

Fine-Tuning Is Sample Hungry

Fine-tuning stores knowledge in the weights of a model, and that is the root of its appetite. Weights are an implicit, distributed record of what the model saw, and moving them reliably toward a new fact takes enough examples for training to find the pattern rather than the noise. Controlled studies bear this out. When researchers compared fine-tuning with supplying knowledge at run time, retrieval outperformed fine-tuning on both familiar and new facts, and fine-tuning absorbed new facts only when it was shown many restatements of each one (Ovadia et al. 2024). A separate study found that models take up new facts through fine-tuning more slowly than facts they already know, and that their tendency to hallucinate rises as those new facts are learned (Gekhman et al. 2024).

For a business, three consequences follow. 

  • The model has to rediscover what the company already knows. The relationship between a well, its field and its production targets is written down somewhere in the company. Fine-tuning ignores that record and asks the model to infer it from examples.
  • Corrections do not travel. Fixing one wrong answer with one new example nudges the weights slightly, and the same mistake on a slightly different case often returns.
  • Every change means another training run. When the business changes, which it always does, someone collects more data and retrains, because the knowledge is locked inside something no one can read or edit.

None of this makes fine-tuning wrong. Its impact is limited to what it can hold still. It works for style, format and narrow skills, and for a single judgment that does not move, as our own evaluator showed, and owning tuned weights is what makes it possible to inspect how a model reasons. What it cannot do is keep pace with a business whose facts, rules and judgment change faster than any training schedule. It is an expensive way to teach a model what the business already knows, and a slow way to teach it what the business has just changed.

Structure Comes Before Data

An ontology is an explicit model of a business: its entities, the relationships between them and the rules they obey. We write ours in open W3C standards, with RDF for relationships (Cyganiak, Wood and Lanthaler 2014), OWL for rules and logic (W3C OWL Working Group 2012) and SHACL for validation (Knublauch and Kontokostas 2017), and serve them to agents through the Model Context Protocol (Anthropic 2024). That changes the sample arithmetic in four ways.

  1. The structure comes for free. The ontology already states that a pump has a pressure rating and that a well belongs to a field. The model reasons with those facts instead of inferring them, so every example it sees goes toward what is new rather than toward the basics.
  2. The space of possible answers narrows. An answer that breaks a rule in the ontology is ruled out before anyone sees it, and with fewer candidate explanations fitting the data, fewer examples are needed to pick the right one. Machine learning has recognized since Mitchell (1980) that a learner can generalize beyond its examples only through prior assumptions, and that domain knowledge is one of the best sources of them. An ontology makes those assumptions explicit and auditable.
  3. One correction carries across many cases. When feedback is tied to a concept instead of a single instance, fixing it once fixes it everywhere the concept applies. Correct how the system treats one type of contract clause and every contract of that type is corrected, so a single correction can do the work of hundreds of examples.
  4. New situations are built from known parts. A case the system has never seen can still be assembled from entities and relationships it already understands, the same compositional ability that makes people efficient learners (Lake et al. 2017). No one needs an example of every combination, because the ontology records how the pieces fit together.

Fine-tuning hides knowledge in weights, which costs data to put there and more data to change. An ontology keeps that knowledge as explicit structure the model reasons with, so each new example teaches the system more. Table 1 sets the two side by side.

Table 1 sets the two side by side

Most Knowledge Is Unwritten

Writing the structure down is only half the work, because much of what a business knows has never been written down. Its knowledge comes in two kinds. Seen knowledge already sits in systems: systems of record, database schemas, procedures, manuals and contracts. Unseen knowledge lives in people. It is the correction a senior engineer makes without explaining it, the override a credit officer applies to an exception, and the judgment that a reading is normal for one well even though it would be alarming on another.

Seen knowledge is the cheaper half to capture. Our forward deployed engineers generate as much of the ontology as they can from existing systems, documents and schemas, then refine it with the people who run the business. Unseen knowledge is captured as it is exercised. Every correction, override and expert judgment is recorded against the concept it concerns, so the next run finds it attached to the pump model or the clause type rather than buried in a review thread.

The context engine turns this record into intelligence the model can use. At run time it selects the part of the ontology a task needs, meaning the entities involved, the rules that govern them and the judgments recorded against them, and serves it to the model as context. The model reasons with that context and does not need to have learned it, and the result is checked against the same structure before anyone acts on it. Language models have been able to perform new tasks from material supplied in the prompt, without any change to their weights, since GPT-3 was shown to work from a handful of examples (Brown et al. 2020). The context engine applies that ability to the whole of a business rather than to a single prompt.

Scored Feedback Improves the Structure

A static ontology still goes stale, because businesses drift. Self-improving ontologies are the answer, and they become a mechanism rather than a phrase once continual learning sits on top of the structure. Every run is recorded and scored, and the score is written back against the concepts and rules the run relied on. Scored feedback updates the structure itself, so the ontology keeps learning alongside the business instead of being rebuilt once a year, and a correction to a rule propagates as quickly as the rule did.

None of this updates model weights. Research on language agents has shown that an agent can improve across attempts by keeping written reflections on its feedback in memory and reading them before the next attempt, with no change to the underlying model (Shinn et al. 2023). We apply the same principle at the level of the organization, holding the improvement in the ontology and in the decision memory each run reads before it acts. This is the loop described in our reference architecture Your Whole Organization Should Be an RL Gym (Bilal 2026a), where a shared model of the business is what makes scores from different runs comparable in the first place. The ontology is the prior that makes each example count, and continual learning is how that prior keeps improving. Figure 1 shows the full path.

Seen and unseen knowledge are captured into the ontologyFigure 1. Seen and unseen knowledge are captured into the ontology, served by the context engine to the model at run time, and scored feedback returns to the ontology. The pump identifiers are illustrative.

 

A New Pump Needs No Failures

Take an operator who wants an agent to flag pumps at risk of failure across a few hundred wells. The details are illustrative, not a benchmark.

On the fine-tuning route, the team collects historical sensor data and maintenance logs, labels failure events and trains. Failures are rare, so there might be a few dozen clean examples per pump type, and from those few dozen the model has to learn what a pump is, which readings matter, how ratings differ by model and how each well relates to its field. It will struggle, and when a new pump model arrives, the collection starts again.

On the ontology route, the asset hierarchy is already in place: field, well, pump, pump model, rated pressure, rated temperature and maintenance history. A rule in OWL states that a pump running above its rated pressure is at risk, and SHACL rejects any reading or recommendation that does not fit the model. The few dozen failure examples now teach only the part that is uncertain, which is the early signal pattern that comes before a failure.

When an engineer corrects the agent on one pump model, that correction attaches to the pump model rather than to one pump, and every well running that model benefits the same day. Each flag the agent raises is later scored against what happened to the pump, and that score returns to the rule that produced it. When a new pump model arrives, someone adds it to the ontology with its ratings, and the system can reason about it before it has seen a single failure.

Ontologies Fail Predictably

Ontologies are not free, and it is worth being plain about where they fall short.

  • Someone has to build the ontology. That is real work. Our forward deployed engineers do it with the people who run the business and generate as much as they can from existing systems, documents and schemas, and the continual learning loop keeps it current once it exists, so it is never rebuilt from nothing.
  • A wrong rule is confidently wrong. If the ontology says something false, the system enforces it everywhere, which is the flip side of a correction carrying across many cases. The remedy is the same mechanism: scoring exposes the rule that keeps producing corrected answers, and the fix propagates as fast as the mistake did.
  • Some things are patterns, not rules. Early failure signals in sensor data are a good example. There we still learn from data, and where a narrow pattern holds still, a tuned model the organization owns may be the right tool. The ontology does not replace learning; it focuses learning on the part that cannot be written down.

Intelligence Should Stay Readable

The choice between weights and structure is finally a choice about where an organization's intelligence lives and who owns it. Knowledge trained into weights cannot be read or edited, has to be trained again when the model changes, and on a rented model does not belong to the organization at all. Knowledge held in an ontology can be read by the people who run the business, corrected in one place, served to whichever model the organization chooses next, and kept in open standards that no vendor controls. The model reasons with the ontology rather than containing it, so what the organization learns stays with the organization.

This is how we now build at CodeNinja, within the Hyper Anthologies ecosystem. Hyper Ontology holds the governed model of the organization. Hyper Engram is decision memory each run reads before it acts, and it does not update model weights. Where a model's weights do carry judgment, Hyper Noesis opens models the organization owns so their reasoning can be inspected. Each one keeps the intelligence in a place the organization can see and keep.

Structure Is the Cheapest Data

The organizations with the most valuable problems rarely have the most data. They have deep knowledge of how their business works and a small number of good examples. Fine-tuning asks them to turn that knowledge into thousands of samples, and to do it again whenever the business changes. An ontology lets them write it down once, capture what their people know as they work, and make every sample count for more. The intelligence that results lives in structure the organization can read and keep, which is where it belonged from the start.

If you are working on a problem where data is scarce and being wrong is expensive, see how Hyper Ontology is built at hyperanthologies.com.

Umar Bilal, Co-Founder, CodeNinja 

SOURCES

  • Anthropic. 2024. “Introducing the Model Context Protocol.” November 25, 2024. https://www.anthropic.com/news/model-context-protocol.
  • Bilal, Umar. 2026a. Your Whole Organization Should Be an RL Gym. CodeNinja Reference Architecture, Version 1.0. CodeNinja.
  • Bilal, Umar. 2026b. “What Belongs in the Weights: Distilling Your Organization's Judgment into a Model You Own.” Own the Loop, Part 3. CodeNinja.
  • Brown, Tom B., et al. 2020. “Language Models Are Few-Shot Learners.” Advances in Neural Information Processing Systems 33: 1877–1901.
  • Cyganiak, Richard, David Wood, and Markus Lanthaler, eds. 2014. RDF 1.1 Concepts and Abstract Syntax. W3C Recommendation, February 25, 2014. https://www.w3.org/TR/rdf11-concepts/.
  • Gekhman, Zorik, et al. 2024. “Does Fine-Tuning LLMs on New Knowledge Encourage Hallucinations?” In Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing, 7765–7784. https://aclanthology.org/2024.emnlp-main.444.
  • Knublauch, Holger, and Dimitris Kontokostas, eds. 2017. Shapes Constraint Language (SHACL). W3C Recommendation, July 20, 2017. https://www.w3.org/TR/2017/REC-shacl-20170720/.
  • Lake, Brenden M., Tomer D. Ullman, Joshua B. Tenenbaum, and Samuel J. Gershman. 2017. “Building Machines That Learn and Think Like People.” Behavioral and Brain Sciences 40: e253. https://doi.org/10.1017/S0140525X16001837.
  • Mitchell, Tom M. 1980. The Need for Biases in Learning Generalizations. Technical Report CBM-TR-117. New Brunswick, NJ: Rutgers University.
  • Ovadia, Oded, Menachem Brief, Moshik Mishaeli, and Oren Elisha. 2024. “Fine-Tuning or Retrieval? Comparing Knowledge Injection in LLMs.” In Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing, 237–250. https://doi.org/10.18653/v1/2024.emnlp-main.15.
  • Shinn, Noah, Federico Cassano, Ashwin Gopinath, Karthik Narasimhan, and Shunyu Yao. 2023. “Reflexion: Language Agents with Verbal Reinforcement Learning.” Advances in Neural Information Processing Systems 36.
  • W3C OWL Working Group. 2012. OWL 2 Web Ontology Language Document Overview (Second Edition). W3C Recommendation, December 11, 2012. https://www.w3.org/TR/owl2-overview/.

ABOUT CODENINJA

CodeNinja is a Middle Eastern-American artificial intelligence lab focused on building self-improving systems. We are reinventing knowledge work to close the loop between vertical AI use cases and the generalized intelligence that fuels it, accelerating the path toward organizational superintelligence.

Contributors

Umar Bilal

Co-Founder