<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Hadeel Sharaf</title>
    <description>The latest articles on DEV Community by Hadeel Sharaf (@hadeelsharaf).</description>
    <link>https://dev.to/hadeelsharaf</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F996202%2F1135346c-612f-4396-af5d-34d20e13f121.jpeg</url>
      <title>DEV Community: Hadeel Sharaf</title>
      <link>https://dev.to/hadeelsharaf</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hadeelsharaf"/>
    <language>en</language>
    <item>
      <title>The Tug of War Between Words: How One Word Can Change an AI's Prediction</title>
      <dc:creator>Hadeel Sharaf</dc:creator>
      <pubDate>Fri, 13 Nov 2026 01:25:34 +0000</pubDate>
      <link>https://dev.to/hadeelsharaf/the-tug-of-war-between-words-how-one-word-can-change-an-ais-prediction-35da</link>
      <guid>https://dev.to/hadeelsharaf/the-tug-of-war-between-words-how-one-word-can-change-an-ais-prediction-35da</guid>
      <description>&lt;p&gt;&lt;em&gt;A practical look at prompt sensitivity, next-token probabilities, negation, and vision-language models.&lt;/em&gt;&lt;br&gt;
Change one word in a prompt and you may change the answer.&lt;/p&gt;

&lt;p&gt;Compare:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  "Describe a &lt;strong&gt;bright&lt;/strong&gt; room."&lt;/li&gt;
&lt;li&gt;  "Describe a &lt;strong&gt;dark&lt;/strong&gt; room."&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The difference is only one word, but the likely descriptions diverge:&lt;br&gt;
sunlight, open windows, and vivid colours in one direction; shadows, dim lighting, and muted colours in the other.&lt;/p&gt;

&lt;p&gt;Now try a less obvious change:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  "Describe a room with a window."&lt;/li&gt;
&lt;li&gt;  "Describe a room &lt;strong&gt;without&lt;/strong&gt; a window."&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For a person, the distinction seems straightforward. For an AI model, that small word changes the constraint the model must interpret and satisfy. The result can be surprisingly inconsistent, especially when a prompt contains several instructions or when the model must reason about an image.&lt;/p&gt;

&lt;p&gt;Why can one word have so much influence?&lt;/p&gt;

&lt;p&gt;The answer is not that every word carries a fixed positive or negative score. It is that a prompt establishes context. That context shapes the model's internal representations and changes the relative scores assigned to possible continuations.&lt;/p&gt;

&lt;p&gt;This is the hidden tug-of-war inside a prompt.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Words do not work alone
&lt;/h2&gt;

&lt;p&gt;A language model does not process a sentence in quite the same way a human reader does. Text is first divided into &lt;strong&gt;tokens&lt;/strong&gt;. A token may represent a whole word, part of a word, punctuation, or another text unit, depending on the tokenizer.&lt;/p&gt;

&lt;p&gt;The tokens are mapped to numerical vectors. As they pass through&lt;br&gt;
Transformer layers, their representations are updated using contextual information. Self-attention allows each position to incorporate information from other positions; feed-forward layers and other operations further transform those representations.&lt;/p&gt;

&lt;p&gt;That means a word's contribution depends on its context.&lt;/p&gt;

&lt;p&gt;Consider:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  "The dog is &lt;strong&gt;inside&lt;/strong&gt; the house."&lt;/li&gt;
&lt;li&gt;  "The dog is &lt;strong&gt;outside&lt;/strong&gt; the house."&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The model does not simply retrieve a permanent score for &lt;em&gt;inside&lt;/em&gt; or &lt;em&gt;outside&lt;/em&gt;. Their representations participate in a sequence of&lt;br&gt;
computations conditioned on the surrounding tokens. Those computations affect what the model is likely to generate next.&lt;/p&gt;

&lt;p&gt;The foundational paper &lt;a href="https://arxiv.org/abs/1706.03762" rel="noopener noreferrer"&gt;Attention Is All You Need&lt;/a&gt; introduced the Transformer architecture and its self-attention mechanism.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Where the tug-of-war happens: logits and probabilities
&lt;/h2&gt;

&lt;p&gt;For an autoregressive language model, the process can be simplified:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; The prompt is tokenized.&lt;/li&gt;
&lt;li&gt; The model computes contextual representations of the input.&lt;/li&gt;
&lt;li&gt; The final representation is projected into a &lt;strong&gt;logit&lt;/strong&gt; for each   token in the vocabulary.&lt;/li&gt;
&lt;li&gt; A softmax function can convert the logits into a probability
distribution.&lt;/li&gt;
&lt;li&gt; A decoding strategy selects the next token. The model then repeats the process with the expanded context.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For candidate token &lt;code&gt;i&lt;/code&gt;, softmax converts logits into probabilities:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;P(token i | context) = exp(z_i) / Σ exp(z_j)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Where:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;z_i&lt;/code&gt; is the logit (raw score) assigned to candidate token &lt;code&gt;i&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;  The denominator sums the exponentiated logits across all candidate tokens.&lt;/li&gt;
&lt;li&gt;  Softmax converts these scores into a probability distribution that  sums to 1.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A higher logit generally results in a higher probability relative to competing candidates.&lt;/p&gt;

&lt;h3&gt;
  
  
  A simplified example
&lt;/h3&gt;

&lt;p&gt;Imagine a model predicting the next token after two different contexts.&lt;br&gt;
The following logits are &lt;strong&gt;hypothetical&lt;/strong&gt;, created only to illustrate the mechanism; they are not measurements from a real model.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prompt A: "A bright ..."&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  sunny: logit 3.0&lt;/li&gt;
&lt;li&gt;  clear: logit 1.0&lt;/li&gt;
&lt;li&gt;  night: logit 0.0&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Prompt B: "A dark ..."&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  sunny: logit 0.5&lt;/li&gt;
&lt;li&gt;  clear: logit 2.5&lt;/li&gt;
&lt;li&gt;  night: logit 1.0&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After applying softmax, the approximate probabilities are:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prompt A: "A bright ..."&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  sunny: 84.4%&lt;/li&gt;
&lt;li&gt;  clear: 11.4%&lt;/li&gt;
&lt;li&gt;  night: 4.2%&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Prompt B: "A dark ..."&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  sunny: 9.9%&lt;/li&gt;
&lt;li&gt;  clear: 73.6%&lt;/li&gt;
&lt;li&gt;  night: 16.5%&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The numbers are illustrative, but the principle is real: changing the context changes the model's internal computation, which can change the logits and therefore the probability distribution.&lt;/p&gt;

&lt;p&gt;This is a more accurate way to understand positive and negative&lt;br&gt;
influence:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Context can make some continuations more compatible with the prompt, increasing their relative logits.&lt;/li&gt;
&lt;li&gt;  Other continuations can become less compatible, decreasing their relative logits.&lt;/li&gt;
&lt;li&gt;  Softmax normalizes the scores into probabilities.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There is no universal positive value attached to &lt;em&gt;bright&lt;/em&gt; or negative value attached to &lt;em&gt;dark&lt;/em&gt;. The effect emerges from learned representations, attention, nonlinear transformations, and the output projection. Attention weights alone do not explain the model's complete behavior.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5k5g3n7fdoq5d1cq1ren.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5k5g3n7fdoq5d1cq1ren.png" alt="Two different prompt contexts produce different probability distributions" width="800" height="410"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3. The smallest word can carry a major constraint: negation
&lt;/h2&gt;

&lt;p&gt;Negation is one of the clearest ways to expose the gap between fluent language generation and reliable instruction following.&lt;/p&gt;

&lt;p&gt;Compare:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  "Find an image containing a dog."&lt;/li&gt;
&lt;li&gt;  "Find an image containing &lt;strong&gt;no&lt;/strong&gt; dog."&lt;/li&gt;
&lt;li&gt;  "Find an image containing a dog, but &lt;strong&gt;not&lt;/strong&gt; on grass."&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The words &lt;em&gt;no&lt;/em&gt; and &lt;em&gt;not&lt;/em&gt; are short, but they change the logical&lt;br&gt;
constraints of the task. In the third example, the model must preserve&lt;br&gt;
one condition (the dog is present) while rejecting another (the dog is on grass).&lt;/p&gt;

&lt;p&gt;Recognizing the token &lt;em&gt;not&lt;/em&gt; is not enough. The model must correctly determine what the negation applies to and maintain that relationship while interpreting the rest of the prompt.&lt;/p&gt;

&lt;p&gt;This is an active research problem. In &lt;a href="https://openaccess.thecvf.com/content/CVPR2025/html/Alhamoud_Vision-Language_Models_Do_Not_Understand_Negation_CVPR_2025_paper.html" rel="noopener noreferrer"&gt;Vision-Language Models Do Not Understand Negation&lt;/a&gt;,&lt;br&gt;
Alhamoud and colleagues introduce NegBench, a benchmark with 79,000&lt;br&gt;
examples across 18 task variations. They report substantial difficulties with negation in the evaluated vision-language models. Their experiments&lt;br&gt;
also investigate whether targeted synthetic training data can improve performance.&lt;/p&gt;

&lt;p&gt;The practical lesson: adding &lt;em&gt;not&lt;/em&gt; to a prompt does not guarantee that a model will reliably enforce the intended exclusion.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. When language meets vision, the competition gets harder
&lt;/h2&gt;

&lt;p&gt;A text-only LLM primarily conditions on linguistic context. A&lt;br&gt;
vision-language model (VLM) must also use visual information.&lt;/p&gt;

&lt;p&gt;The exact architecture varies. For example,&lt;br&gt;
&lt;a href="https://arxiv.org/abs/2304.08485" rel="noopener noreferrer"&gt;LLaVA&lt;/a&gt; connects a vision encoder to a language model through a learned projection, allowing visual features to be used alongside textual instructions. Other VLMs use different encoders, fusion mechanisms, tokenization schemes, and processing&lt;br&gt;
pipelines.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7lh50ixinrorwsatc2ba.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7lh50ixinrorwsatc2ba.png" alt="Visual information and textual instructions combine to influence a model's interpretation and possible outputs" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Imagine providing a photograph of a dog standing on grass and asking:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  "Describe the image."&lt;/li&gt;
&lt;li&gt;  "Describe the image, but do not mention the dog."&lt;/li&gt;
&lt;li&gt;  "Describe the dog without mentioning the grass."&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The image provides visual evidence. The prompt specifies which aspects of that evidence matter to the requested response. The word &lt;em&gt;not&lt;/em&gt; does not remove the dog or grass from the image representation; it changes the linguistic constraint the model is being asked to follow.&lt;/p&gt;

&lt;p&gt;Whether the model obeys that constraint depends on how its architecture and training have learned to connect language with visual content.&lt;/p&gt;

&lt;p&gt;Research on multimodal prompt sensitivity reinforces the point.&lt;br&gt;
&lt;a href="https://aclanthology.org/2025.findings-emnlp.1302/" rel="noopener noreferrer"&gt;Promptception: How Sensitive Are Large Multimodal Models to&lt;br&gt;
Prompts?&lt;/a&gt; studies how prompt variations affect multimodal question answering. The authors report accuracy deviations of up to 15 percentage points for certain prompt variations and model/task combinations. This is not evidence that every wording change has the same effect on every VLM; it shows that phrasing can materially affect performance under some conditions.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Try the experiment: change one word at a time
&lt;/h2&gt;

&lt;p&gt;You do not need access to a model's internal logits to observe prompt sensitivity. Start with a fixed task and vary one phrase at a time.&lt;/p&gt;

&lt;h3&gt;
  
  
  Experiment A: a text model
&lt;/h3&gt;

&lt;p&gt;Keep the input document fixed and change the instruction:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Original:&lt;/strong&gt; "Summarize this incident report in three bullet
points."&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;More concise:&lt;/strong&gt; "Summarize this incident report in three concise bullet points."&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Add a requirement:&lt;/strong&gt; "Summarize this incident report in three bullet points, including the root cause."&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Add an exclusion:&lt;/strong&gt; "Summarize this incident report in three bullet points, excluding personal details."&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Experiment B: a vision-language model
&lt;/h3&gt;

&lt;p&gt;Keep the image fixed and vary only the instruction:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; "Describe the image."&lt;/li&gt;
&lt;li&gt; "Describe the image without mentioning people."&lt;/li&gt;
&lt;li&gt; "Describe the image, focusing only on the background."&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Compare the outputs across several examples, not just one. Record&lt;br&gt;
whether the model followed each constraint, omitted required&lt;br&gt;
information, or introduced details that were not supported by the input.&lt;/p&gt;

&lt;p&gt;For a more rigorous experiment, keep the model version, decoding&lt;br&gt;
settings, input data, and evaluation criteria fixed. If you have access to token log-probabilities, compare them too---but remember that a change in one next-token probability does not, by itself, explain the entire response.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. What this means for prompt design
&lt;/h2&gt;

&lt;p&gt;The underlying mechanics suggest a few practical habits:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Avoid contradictory instructions.&lt;/strong&gt; "Be extremely brief" and "explain every detail" compete. State which requirement takes
priority.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Make exclusions specific.&lt;/strong&gt; Replace "avoid irrelevant details"  with a clear description of what to omit.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Separate constraints.&lt;/strong&gt; Use distinct instructions for the task, output format, and exclusions.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Test wording instead of assuming equivalence.&lt;/strong&gt; Two prompts that mean nearly the same thing to a person may not produce equivalent model behavior.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Evaluate with representative inputs.&lt;/strong&gt; For VLMs, test the actual kinds of images the system will encounter. A text-only test cannot establish visual grounding.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Conclusion: a prompt reshapes the probability landscape
&lt;/h2&gt;

&lt;p&gt;A prompt is more than a list of instructions. It supplies context that shapes a model's internal representations and changes the relative likelihood of possible continuations.&lt;/p&gt;

&lt;p&gt;A single word can matter because it changes the relationships the model computes; not because the word carries a universal positive or negative score.&lt;/p&gt;

&lt;p&gt;When language meets vision, the challenge becomes even more interesting: the model must reconcile what it sees with what the prompt asks it to describe, identify, or ignore.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Words do not simply tell AI what to do. They reshape the competition between possible interpretations and possible predictions.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt; Vaswani, A. et al.&amp;nbsp;(2017). &lt;a href="https://arxiv.org/abs/1706.03762" rel="noopener noreferrer"&gt;Attention Is All You
Need&lt;/a&gt;. NeurIPS.&lt;/li&gt;
&lt;li&gt; Liu, H. et al.&amp;nbsp;(2023). &lt;a href="https://arxiv.org/abs/2304.08485" rel="noopener noreferrer"&gt;Visual Instruction
Tuning&lt;/a&gt;. NeurIPS 2023.&lt;/li&gt;
&lt;li&gt; Alhamoud, K. et al.&amp;nbsp;(2025). &lt;a href="https://openaccess.thecvf.com/content/CVPR2025/html/Alhamoud_Vision-Language_Models_Do_Not_Understand_Negation_CVPR_2025_paper.html" rel="noopener noreferrer"&gt;Vision-Language Models Do Not
Understand Negation&lt;/a&gt;.
CVPR 2025.&lt;/li&gt;
&lt;li&gt; Ismithdeen, M. I., Khattak, M. U., &amp;amp; Khan, S. (2025).
&lt;a href="https://aclanthology.org/2025.findings-emnlp.1302/" rel="noopener noreferrer"&gt;Promptception: How Sensitive Are Large Multimodal Models to
Prompts?&lt;/a&gt;.     Findings of EMNLP 2025.&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>llm</category>
      <category>promptengineering</category>
      <category>machinelearning</category>
      <category>ai</category>
    </item>
    <item>
      <title>Semantic Code Intelligence: Helping AI Agents Navigate Codebases</title>
      <dc:creator>Hadeel Sharaf</dc:creator>
      <pubDate>Sat, 24 Oct 2026 20:44:18 +0000</pubDate>
      <link>https://dev.to/hadeelsharaf/semantic-code-intelligence-helping-ai-agents-navigate-codebases-52p8</link>
      <guid>https://dev.to/hadeelsharaf/semantic-code-intelligence-helping-ai-agents-navigate-codebases-52p8</guid>
      <description>&lt;p&gt;&lt;em&gt;Finding code is easy. Finding the right code—and understanding what a change might affect—is harder.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Imagine asking an AI coding agent to modify a payment retry policy.&lt;/p&gt;

&lt;p&gt;It finds the function responsible for retries, changes it, and reports success. But another module calls that function, a configuration controls its behavior, and existing tests depend on its current contract.&lt;/p&gt;

&lt;p&gt;The problem is not necessarily that the agent cannot write code. It may not have retrieved enough context to understand the change.&lt;/p&gt;

&lt;p&gt;This is where &lt;strong&gt;semantic code intelligence&lt;/strong&gt; becomes useful: a collection of techniques that help developers and AI agents navigate code using its structure, symbols, relationships, and sometimes semantic similarity.&lt;/p&gt;

&lt;p&gt;It is a broad industry term rather than a single standardized technology. Different implementations provide different capabilities.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Text Search vs. Code Intelligence
&lt;/h2&gt;

&lt;p&gt;Suppose you want to find where &lt;code&gt;getUser&lt;/code&gt; is defined.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-rn&lt;/span&gt; &lt;span class="s2"&gt;"getUser"&lt;/span&gt; src/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This returns textual matches, potentially including definitions, calls, comments, and tests.&lt;/p&gt;

&lt;p&gt;A language-aware tool can resolve the symbol and locate its definition, provided the language server supports that operation and has sufficient project information.&lt;/p&gt;

&lt;p&gt;The distinction is simple: &lt;strong&gt;text search finds matching text; symbol-aware navigation can identify code entities and their relationships.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Both are useful. The challenge is choosing the right method for the question.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. The Main Building Blocks
&lt;/h2&gt;

&lt;p&gt;Semantic code intelligence combines several complementary techniques.&lt;/p&gt;

&lt;h3&gt;
  
  
  Syntax parsing
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://tree-sitter.github.io/tree-sitter/" rel="noopener noreferrer"&gt;Tree-sitter&lt;/a&gt; parses source code into syntax trees. It can identify functions, classes, expressions, and other structures, making it useful for structural queries and symbol-aware code chunking.&lt;/p&gt;

&lt;p&gt;Parsing alone does not resolve every symbol or establish the complete meaning of a program.&lt;/p&gt;

&lt;h3&gt;
  
  
  Symbol navigation and indexing
&lt;/h3&gt;

&lt;p&gt;Two important technologies are the Language Server Protocol (LSP) and SCIP.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;LSP&lt;/strong&gt; defines communication between development tools and language servers. Depending on the implementation, it supports go-to-definition, find-references, and rename.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SCIP&lt;/strong&gt; is a language-agnostic protocol for indexing source code to support code navigation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;See the &lt;a href="https://microsoft.github.io/language-server-protocol/" rel="noopener noreferrer"&gt;LSP specification&lt;/a&gt; and the &lt;a href="https://github.com/scip-code/scip" rel="noopener noreferrer"&gt;SCIP project&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;These technologies serve different purposes: LSP defines a communication protocol, while SCIP defines an indexing format.&lt;/p&gt;

&lt;p&gt;Neither guarantees complete results across every language feature or repository. Accuracy depends on language support, index coverage, project configuration, and freshness.&lt;/p&gt;

&lt;h3&gt;
  
  
  Embeddings and vector search
&lt;/h3&gt;

&lt;p&gt;Sometimes you know the behavior you are looking for but not which function implements it.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Where do we retry failed payments?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Embedding-based retrieval represents code snippets and queries as vectors, then retrieves candidates based on similarity.&lt;/p&gt;

&lt;p&gt;This helps discover implementations when the query and source code use different terminology. However, similarity does not prove functional equivalence.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use embeddings to discover candidates, not to guarantee exhaustive references or prove behavior.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Code graphs
&lt;/h3&gt;

&lt;p&gt;Code graphs represent relationships such as function calls, imports, dependencies, and inheritance.&lt;/p&gt;

&lt;p&gt;They help investigate questions such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Which functions call this method?&lt;/li&gt;
&lt;li&gt;Which modules depend on this interface?&lt;/li&gt;
&lt;li&gt;What might be affected by changing this component?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Static graphs may miss relationships involving dynamic dispatch, reflection, generated code, or runtime configuration. Dependency information also does not guarantee that a change is safe.&lt;/p&gt;

&lt;h3&gt;
  
  
  Hybrid retrieval
&lt;/h3&gt;

&lt;p&gt;A retrieval pipeline can combine lexical search, semantic similarity, and structural information.&lt;/p&gt;

&lt;p&gt;A typical workflow is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Split source code into symbol-aware chunks.&lt;/li&gt;
&lt;li&gt;Index chunks using BM25 or another lexical retrieval method.&lt;/li&gt;
&lt;li&gt;Generate embeddings for semantic retrieval.&lt;/li&gt;
&lt;li&gt;Merge and rerank the retrieved candidates.&lt;/li&gt;
&lt;li&gt;Use symbol and dependency information to refine the results where available.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Lexical retrieval finds relevant terms, embeddings surface conceptually related code, and reranking helps prioritize candidates.&lt;/p&gt;

&lt;p&gt;Hybrid retrieval is not automatically more accurate. Its effectiveness depends on indexing, chunking, ranking, and the quality of the underlying data.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. A Practical Example: Changing a Payment Retry Policy
&lt;/h2&gt;

&lt;p&gt;Consider an agent asked to increase the maximum number of payment retries.&lt;/p&gt;

&lt;p&gt;A text search might find several occurrences of &lt;code&gt;retry&lt;/code&gt;, but the relevant behavior could be distributed across a service, configuration file, and test suite.&lt;/p&gt;

&lt;p&gt;Here is how different retrieval methods can help:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Step&lt;/th&gt;
&lt;th&gt;Method&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Lexical search&lt;/td&gt;
&lt;td&gt;Find retry-related identifiers and configuration keys&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Semantic retrieval&lt;/td&gt;
&lt;td&gt;Discover implementations described using unfamiliar terminology&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;Symbol indexing&lt;/td&gt;
&lt;td&gt;Locate definitions and references for the relevant functions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Dependency analysis&lt;/td&gt;
&lt;td&gt;Identify potentially affected callers and components&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;Test discovery and execution&lt;/td&gt;
&lt;td&gt;Check expected behavior and detect regressions&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;For example, a search for &lt;code&gt;retry&lt;/code&gt; might reveal &lt;code&gt;retry_payment()&lt;/code&gt;, &lt;code&gt;max_attempts&lt;/code&gt;, and &lt;code&gt;recover_transaction()&lt;/code&gt;. Symbol resolution can then distinguish the definition of &lt;code&gt;retry_payment()&lt;/code&gt; from its callers, while dependency analysis helps trace how the function is used.&lt;/p&gt;

&lt;p&gt;These are illustrative names, not measured search results.&lt;/p&gt;

&lt;p&gt;The key is that each step answers a different question. Semantic retrieval helps discover candidates; symbol indexing helps establish code relationships; tests provide evidence about behavior.&lt;/p&gt;

&lt;p&gt;None of these steps alone proves that every relevant component has been found or that the resulting change is correct.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Why This Matters for AI Coding Agents
&lt;/h2&gt;

&lt;p&gt;AI coding agents need relevant context before modifying a codebase. Without effective retrieval, they may repeatedly search files, read unrelated sections, and manually reconstruct dependencies.&lt;/p&gt;

&lt;p&gt;This can lead to unnecessary token consumption, missed dependencies, incomplete changes, and repeated discovery work.&lt;/p&gt;

&lt;p&gt;Persistent indexes can make symbol and relationship information available across tasks, reducing repeated exploration. Their value depends on the repository, language support, indexing overhead, and how frequently the code changes.&lt;/p&gt;

&lt;p&gt;Better retrieval can improve the context available to an agent, but it does not guarantee correct reasoning or safe modifications. The agent must still inspect the source, validate assumptions, and test its changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Choosing the Right Tool
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Engineering question&lt;/th&gt;
&lt;th&gt;Suitable approach&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Where does this exact string appear?&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;grep&lt;/code&gt; or lexical search&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Where is this function defined?&lt;/td&gt;
&lt;td&gt;LSP or a suitable symbol index&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Which references resolve to this symbol?&lt;/td&gt;
&lt;td&gt;LSP or SCIP-based indexing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Where is this behavior implemented?&lt;/td&gt;
&lt;td&gt;Lexical and semantic retrieval, followed by source inspection&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Which components may be affected by a change?&lt;/td&gt;
&lt;td&gt;Dependency analysis and code graphs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Which tests should be examined?&lt;/td&gt;
&lt;td&gt;Test discovery, dependency analysis, and coverage data&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These capabilities can be exposed to AI agents through APIs, tools, or integrations such as the &lt;a href="https://modelcontextprotocol.io/" rel="noopener noreferrer"&gt;Model Context Protocol (MCP)&lt;/a&gt;. The agent should use only the capabilities actually supported by the integration.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Trade-offs to Consider
&lt;/h2&gt;

&lt;p&gt;Before introducing code intelligence, consider the operational costs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Index freshness:&lt;/strong&gt; Outdated indexes can produce misleading results. Incremental updates or reindexing are essential.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Language support:&lt;/strong&gt; Indexing capabilities and precision vary across languages and frameworks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Infrastructure cost:&lt;/strong&gt; Persistent indexes require storage, compute, and maintenance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Retrieval quality:&lt;/strong&gt; Embeddings and rerankers need evaluation; similarity scores alone do not establish correctness.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Analysis limitations:&lt;/strong&gt; Static analysis may not capture all runtime behavior.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security:&lt;/strong&gt; Code indexes and embedding stores can contain proprietary source information and require appropriate access controls.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For a small repository, ordinary search and existing language-server features may be sufficient. For large monorepos or agent workflows involving frequent cross-file changes, additional indexing and dependency analysis may justify the complexity.&lt;/p&gt;

&lt;p&gt;Start with existing search, add symbol-aware navigation where needed, and introduce semantic retrieval or graph analysis when specific problems justify them. Evaluate the result using representative tasks, retrieval precision and recall, index freshness, latency, token consumption, and end-to-end task success.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Semantic code intelligence is not a replacement for text search. It combines complementary techniques to retrieve code with different levels of structural and semantic information.&lt;/p&gt;

&lt;p&gt;Use lexical search for exact matches, symbol indexing for definitions and references, embeddings for discovering implementations by intent, and code graphs for exploring dependencies and potential impact.&lt;/p&gt;

&lt;p&gt;For AI coding agents, the objective is not to retrieve more code indiscriminately. It is to retrieve relevant evidence, understand its limitations, and validate the resulting changes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The goal is not to make every search semantic. It is to retrieve the right evidence for the question being asked.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>architecture</category>
      <category>agents</category>
    </item>
    <item>
      <title>Ontology-Driven Observability for Agentic Monitoring</title>
      <dc:creator>Hadeel Sharaf</dc:creator>
      <pubDate>Tue, 20 Oct 2026 22:01:56 +0000</pubDate>
      <link>https://dev.to/hadeelsharaf/ontology-driven-observability-for-agentic-monitoring-2op0</link>
      <guid>https://dev.to/hadeelsharaf/ontology-driven-observability-for-agentic-monitoring-2op0</guid>
      <description>&lt;p&gt;Traditional observability tells us what is happening in our systems. Ontology-driven observability helps us understand how system components are connected — and gives AI agents better context to investigate incidents.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. What Is Ontology-Driven Observability?
&lt;/h2&gt;

&lt;p&gt;It starts with a shared model of the system: its services, databases, users, infrastructure, and their relationships.&lt;/p&gt;

&lt;p&gt;Instead of treating metrics, logs, and traces as isolated signals, telemetry is connected to a &lt;strong&gt;knowledge graph&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;checkout-service → depends_on → payments-db
checkout-service → runs_on → node-01
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each statement is a triple: &lt;strong&gt;Subject → Predicate → Object&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The result is a connected view of the system that supports dependency analysis, impact assessment, and root-cause investigation.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Use Case Without LLMs or AI Agents
&lt;/h2&gt;

&lt;p&gt;Ontology-driven observability is useful even without AI.&lt;/p&gt;

&lt;p&gt;Consider a payments database that becomes unavailable.&lt;/p&gt;

&lt;p&gt;A graph-based monitoring system can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Identify services that depend on the database.&lt;/li&gt;
&lt;li&gt;Calculate the potential blast radius of the failure.&lt;/li&gt;
&lt;li&gt;Apply predefined rules to correlate the incident with service health.&lt;/li&gt;
&lt;li&gt;Alert the responsible teams with dependency context.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is deterministic, rule-based monitoring. The knowledge graph provides context, while predefined queries and rules perform the analysis.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Use Case for Agentic Monitoring
&lt;/h2&gt;

&lt;p&gt;Now introduce an LLM-powered agent.&lt;/p&gt;

&lt;p&gt;When checkout latency increases, a monitoring agent can query the knowledge graph to identify affected services and their dependencies. It can then investigate relevant metrics, logs, traces, and deployment events.&lt;/p&gt;

&lt;p&gt;A multi-agent workflow could delegate these investigations to specialized agents and combine their findings into an evidence-backed root-cause hypothesis.&lt;/p&gt;

&lt;p&gt;The workflow becomes:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Detect → Explore dependencies → Investigate telemetry → Correlate evidence → Recommend action&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This approach aligns with Netflix's E2EGraph initiative, presented at &lt;a href="https://qconlondon.com/presentation/mar2026/ontology-driven-observability-building-e2e-knowledge-graph-netflix-scale" rel="noopener noreferrer"&gt;QCon London 2026&lt;/a&gt;, which explores knowledge-graph-backed observability and agent-assisted root-cause analysis at scale.&lt;/p&gt;

&lt;p&gt;Importantly, the graph provides structured context; it does not automatically prove causation. Agents must still validate their hypotheses against actual telemetry.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Should We Prefer This Approach?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;It depends on system complexity.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Ontology-driven observability is particularly valuable when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Incidents cross multiple services, infrastructure layers, and teams.&lt;/li&gt;
&lt;li&gt;Telemetry is scattered across different tools.&lt;/li&gt;
&lt;li&gt;Root-cause analysis requires understanding complex dependencies.&lt;/li&gt;
&lt;li&gt;AI agents need reliable, structured context rather than relying on raw logs alone.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For smaller systems, conventional observability with consistent instrumentation, useful tags, and distributed tracing may be sufficient. &lt;a href="https://opentelemetry.io/docs/concepts/semantic-conventions/" rel="noopener noreferrer"&gt;OpenTelemetry Semantic Conventions&lt;/a&gt; provide a practical starting point.&lt;/p&gt;

&lt;p&gt;A complete knowledge graph introduces additional costs: ontology design, data integration, graph maintenance, and governance.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Should Agentic Monitoring Run in a Sandbox?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Develop and test it in a sandbox or staging environment first.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;However, the knowledge graph and observability pipeline do not inherently need to run in a sandbox. The critical security concern is the agent's execution environment and permissions.&lt;/p&gt;

&lt;p&gt;A practical rollout strategy is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Sandbox:&lt;/strong&gt; Test incident scenarios, graph queries, agent reasoning, and tool calls using synthetic or sanitized telemetry.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Production read-only mode:&lt;/strong&gt; Allow agents to query approved production telemetry and propose explanations without changing the system.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Controlled remediation:&lt;/strong&gt; Introduce actions such as restarting services or rolling back deployments only with strict permissions, independent validation, and human approval where appropriate.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Sandboxing and least-privilege access help limit the consequences of incorrect reasoning or unintended tool calls. For further guidance, see &lt;a href="https://developers.openai.com/api/docs/guides/agents/guardrails-approvals" rel="noopener noreferrer"&gt;OpenAI's documentation on agent guardrails and human review&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Ontology-driven observability is not a replacement for traditional monitoring. It is a way to add &lt;strong&gt;shared context and connected system knowledge&lt;/strong&gt; to it.&lt;/p&gt;

&lt;p&gt;Rules can use the graph to perform deterministic analysis. LLM-powered agents can use the same graph to investigate incidents dynamically and coordinate more complex workflows.&lt;/p&gt;

&lt;p&gt;The strongest starting point is simple: establish &lt;strong&gt;reliable telemetry and system relationships&lt;/strong&gt; first, then introduce &lt;strong&gt;agentic analysis&lt;/strong&gt; where it provides measurable value.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>observability</category>
      <category>ai</category>
      <category>knowledgegraphs</category>
    </item>
  </channel>
</rss>
