AhmadNotes

My Commends

Quick updates, thoughts, and moments from my day.

Ahmad Shajahan

Ahmad Shajahan

Software Engineer | Building AI & Full-Stack Systems

Rethinking the Path to AGI: Next-Token Prediction, JEPA, and Yann LeCun's Approach

Rethinking the Path to AGI: Next-Token Prediction, JEPA, and Yann LeCun's Approach

The present AI system, based fundamentally on the next-best token prediction approach, has many limitations. A major problem is with its methodology, in particular as it applies to axis clipping in the vector space representation. Since billions of words are mapped into an $N$-dimensional vector space, clipping operations are counterproductive and limit the model's usefulness for attaining Artificial General Intelligence (AGI).

In addition, the JEPA architecture as it is currently designed appears flawed in its application to next best pixel prediction. The effort to achieve AGI seems to depend too heavily on a mistaken understanding of clipping theorems which have not yet been thoroughly published by the research community. For these reasons, I am not ready to accept the present course of development.

The main aim of AGI research should be to model next-step probabilities and to investigate the space of JEPA representations rather than just optimising the next most probable sequence. Even models that make use of cutting-edge research, such as Yan LeCun's, are based entirely on human-generated data without incorporating rigorous mathematical data structures. Hence, the current state of these models amounts to sophisticated pattern recognition and not true Artificial General Intelligence.

Commend attachment
##AGI #ArtificialGeneralIntelligence #AI #ArtificialIntelligence #MachineLearning #DeepLearning #JEPA #YannLeCun #AIResearch #RepresentationLearning #WorldModels #Mathematics #FutureOfAI
Ahmad Shajahan

Ahmad Shajahan

Software Engineer | Building AI & Full-Stack Systems

AI Code Generation: More Code ≠ Better Software

AI Code Generation: More Code ≠ Better Software

AI has changed how quickly we can build software.

We can now generate features, APIs, integrations, tests, and entire modules in seconds. But there is a side effect we need to think about:

More Code → More Functionality → More Complexity → Larger Attack Surface → More Security Risk

The problem isn't AI-generated code itself.

The real problem is accepting generated code without understanding, validating, and continuously monitoring it.

The security mindset

1. Validate AI-generated code
Don't blindly trust generated output. Understand what the code does and what it depends on.

2. Review & Test
Security testing, code review, dependency checks, and edge-case testing are essential.

3. Follow Secure Practices
Use proper authentication, authorization, input validation, secrets management, and secure frameworks.

4. Keep It Simple
Not every generated feature needs to become part of the product. Reduce unnecessary code and complexity.

5. Continuously Monitor
Security isn't a one-time activity. Monitor the system, dependencies, logs, and newly introduced vulnerabilities.

AI makes writing code cheaper. That makes good engineering judgment even more valuable.

Build faster. But build with intention. 🔐

#AI #AICoding #CyberSecurity #SoftwareEngineering #SecureCoding #GenerativeAI #ResponsibleAI #AppSec

Commend attachment
##software #aicodee #agentic
Ahmad Shajahan

Ahmad Shajahan

Software Engineer | Building AI & Full-Stack Systems

Graph RAG — Knowledge Graph–Enhanced Retrieval-Augmented Generation

Graph RAG — Knowledge Graph–Enhanced Retrieval-Augmented Generation

Graph RAG is an advanced Retrieval-Augmented Generation system that combines Large Language Models (LLMs), vector search, and knowledge graphs to provide more accurate, contextual, and explainable answers from complex datasets.

Unlike traditional RAG, which retrieves independent text chunks based mainly on semantic similarity, Graph RAG understands the relationships between entities, concepts, documents, and events. This enables multi-hop retrieval and relationship-aware reasoning before generating an answer.

Key Features

  • 🧠 Knowledge Graph Construction — Extracts entities and relationships from unstructured documents.
  • 🔍 Hybrid Retrieval — Combines vector similarity search with graph-based retrieval.
  • 🔗 Multi-Hop Reasoning — Traverses connected entities to answer complex questions.
  • 📚 Context-Aware Generation — Provides relevant graph and document context to the LLM.
  • 🔎 Explainable Retrieval — Makes retrieved entities, relationships, and sources traceable.
  • ⚡ Scalable Architecture — Designed for large and continuously evolving knowledge bases.

Architecture

Documents → Entity & Relationship Extraction → Embeddings + Knowledge Graph → Hybrid Retrieval → Graph Traversal → Context Construction → LLM → Grounded Answer

Technologies

Python · LLMs · RAG · Knowledge Graphs · Embeddings · Vector Databases · Graph Databases · NLP · Semantic Search

Why Graph RAG?

Traditional RAG is excellent at finding relevant passages, but it can struggle when an answer depends on relationships between multiple pieces of information.

Graph RAG adds a structured knowledge layer, allowing the system to retrieve and reason over connected information rather than treating every document chunk as an isolated piece of text.

Result: A more contextual, relationship-aware, and explainable AI retrieval system.

Commend attachment
##RAag##machinelearning #ai
Ahmad Shajahan

Ahmad Shajahan

Software Engineer | Building AI & Full-Stack Systems

I Built a Transformer From Scratch — In C AND Python — And Proved It's Correct by Making Them Agree to 1e-15

No PyTorch. No TensorFlow. No NumPy. Just the standard library, in two languages, implementing every single piece of "Attention Is All You Need" (Vaswani et al., 2017) by hand. What CTransformer is A dependency-free, paper-faithful implementation of the original Transformer encoder-decoder architecture — built twice, once in pure C and once in pure Python — covering every core component: Multi-head scaled dot-product attention Causal masking for decoder self-attention Encoder–decoder cross-attention Position-wise feed-forward networks LayerNorm + residual connections (post-norm, as in the original paper) Sinusoidal positional encoding Greedy autoregressive decoding Every matrix multiply, every softmax, every normalization — hand-written, in both languages. The part I'm actually proud of Anyone can claim their from-scratch implementation is "correct." I wanted proof, not a claim. So both the C and Python versions share the exact same deterministic PRNG — a hand-written xorshift64 generator feeding a Box–Muller transform for Gaussian sampling, used for Xavier/Glorot weight initialization. Seed them identically, and both languages generate bit-identical weights. Run the forward pass on both, and the logits match to: Code That gap is floating-point rounding noise — nothing more. When two completely independent implementations, written in two different languages with two different type systems and memory models, agree to machine precision, you've proven the math is right in a way unit tests on individual functions never can. Why build this I wanted to actually understand attention — not import it. Writing matmul, softmax, and LayerNorm by hand in C forces you to confront every shape mismatch and every numerical stability issue that a framework normally hides from you. Current scope: inference only, untrained (random) weights — so the generated text is gibberish by design. The goal wasn't a working translator, it was a provably correct implementation of the architecture. Backprop and training are the natural next step. Repo 🔗 https://github.com/ahmadshajhan/CTransformer MIT licensed. Feedback, issues, and PRs welcome — especially if you want to help push this toward a trainable version. #MachineLearning #DeepLearning #Transformers #AttentionIsAllYouNeed #C #Python #FromScratch #OpenSource #AI #SystemsProgramming

Commend attachment