Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ replay_pid*
.DS_Store
images/.DS_Store


16 changes: 16 additions & 0 deletions gen_ai/a2a_read.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
1) Wrap your agent in A2A agent and Publish the agent card.
2) Agent card is a JSON document which publishes
1> Capabilities
2> Endpoints
3> Authentication Requirement
3) Agent client itself is an Agent, discovers the agent structure the request using the agent card.
4) it is a seamless-standardized communication

|--------------------|
| |
i) | Orchestrator Agent |==> A2A Client => Logistic Agent (A2A Server)
|____________________|
|
|=================> A2A Client => Product RAG Agent (A2A Server)
5) MCP connects agent to external system
6) A2A is a standardized seamless connection to a peer agent
128 changes: 128 additions & 0 deletions gen_ai/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# Comprehensive Summary of AI/ML Concepts and Roadmap

**Purpose:**
This document captures the detailed conversation covering AI/ML concepts, embeddings, vector dimensions, LLM internals, multimodal models, storage, offline execution, real-time inference, fine-tuning, and career roadmap. It is structured to reflect the full conversation so that a third-party can understand the context without prior knowledge.

---

## Section 1: Word Embeddings and Vector Dimensions

* Word embeddings map words to high-dimensional vectors (e.g., BERT uses 768 dimensions).
* Each dimension is abstract and not human-readable; meaning emerges from combinations.
* Embeddings are contextual: the same word in different sentences produces different vectors.
* Floating-point numbers are used for gradient computation and precise similarity.
* Dimension trade-offs:

* 128D: fast, small, less precise
* 768D: balanced
* 1536–3072D: very expressive, slower, larger storage

---

## Section 2: Recommended Embedding Dimensions by Data Type

| Data Type | Recommended Dimension |
|------------|-----------------------|
| Text | 768–1536 |
| Image | 512–1024 |
| Audio | 128–512 |
| Video | 1024–2048 |
| Multimodal | 1024–1536 |

* Multimodal models may align separate embeddings into a shared latent space.
* Higher dimensions = more capacity but higher storage, RAM, and latency.

---

## Section 3: LLM Embeddings and Storage

* Internal LLM embeddings are transient and not stored.
* Knowledge is stored in model weights, not DBs.
* Application embeddings (documents/images/audio) are stored in vector DBs for retrieval.
* LLMs can work offline with only the model weights.
* System size requirements depend on parameter count, precision, and architecture.

---

## Section 4: LLM vs Model vs Provider

* Model: a neural network trained on data
* LLM: large language-focused model
* Provider: organization hosting models (OpenAI, Google)
* GPT-3 cannot be directly used without API access or local weights.

---

## Section 5: Multimodal Models

* CLIP-style: text + image embeddings via contrastive learning
* Vision-Language Transformers: cross-attention across modalities
* Audio-Visual-Language: separate encoders + late fusion
* Universal embedding dimensions (1024–1536) are practical for multimodal integration
* Trade-offs: expressiveness vs compute/storage cost

---

## Section 6: Fine-Tuning and Model Building

* Knowledge required: Python, PyTorch/TensorFlow, Hugging Face Transformers, data preprocessing, GPU/TPU usage

---

## Section 7: Recommended Learning Technologies (15-Year Horizon)

* Programming & frameworks: Python, PyTorch, TensorFlow, JAX
* Data engineering: SQL, Spark, Kubernetes, Airflow
* Model deployment: Docker, ONNX, Triton, cloud ML services
* AI research: Transformers, Diffusion Models, Multimodal models
* Tools & concepts: vector DBs, embeddings, real-time inference, RAG

---

## Section 8: TensorFlow Overview

* Open-source ML framework by Google
* Supports computation graphs and high-level APIs
* Used for neural networks, reinforcement learning, and deep learning research

---

## Section 9: Career Roadmap for Experienced Java Professionals

1. Foundational: Linear algebra, probability, statistics, Python
2. AI/ML Engineer: model building, deployment, data pipelines, embeddings
3. AI/ML Architect: system-level design, multimodal & LLM integration, real-time inference
4. Advanced: model optimization, distributed training, vector DBs, RAG

---

## Section 10: Real-Time Processing in AI/ML

* AI/ML real-time processing = models infer & respond live
* Examples: chatbots, autonomous vehicles, financial monitoring
* Requires efficient embeddings, low-latency inference, optimized hardware

---

## Section 11: Storage and System Trade-Offs

| Factor | Low Dim | Medium Dim | High Dim |
|-----------------|------------|-----------------------|-------------------|
| Accuracy | Low | High | Very High |
| Speed | Very Fast | Moderate | Slower |
| Storage | Low | Moderate | High |
| Compute | Low | Medium | High |
| Recommended Use | Small apps | Enterprise/Multimodal | Research/Heavy ML |

* FP16/FP32 standard for embeddings; INT8 for inference optimization
* LLM knowledge resides in weights; embeddings computed dynamically

---

## Section 12: Key Takeaways

* Embeddings are distributed, contextual, dynamic
* LLMs store knowledge in weights, not databases
* Multimodal systems benefit from 1024–1536 dimensions
* Offline LLMs function fully with stored weights
* Career roadmap: foundation → engineer → architect → research leadership
Binary file added images/JDK_JRE_JVM.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/JVM_Heap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/JVM_Memory_Management.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions memory_management/read/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
It is essential to understand the memory structure and management in java virtual machine for developing high performing java applications efficiently.

The JVM is divided into several logical data areas, each performing a specific role during program execution.
## JDK vs JRE vs JVM
<img src="../../images/JDK_JRE_JVM.png" width="400" height="200">

## JVM Memory
<img src="../../images/JVM_Memory_Management.png" width="400" height="200">

These logical areas in memory are

Expand Down Expand Up @@ -30,6 +35,8 @@ This shared access allows objects to be passed between threads and persist beyon

The JVM divides heap into two regions: The Young Generation and the Old Generation. This layout, known as the Generational Heap Model, is based on the principle that most objects in Java applications are short-lived, and those that survive are likely to live much longer.

<img src="../../images/JVM_Heap.png" width="300" height="150">

### Young Generation

All newly created objects start their lifecycle in young generation.It is optimized for fast allocation and frequent garbage collection.
Expand Down
24 changes: 24 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.naga</groupId>
<artifactId>java-must-read</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>21</source>
<target>21</target>
</configuration>
</plugin>
</plugins>
</build>


</project>
84 changes: 84 additions & 0 deletions python/.ipynb_checkpoints/python_basics-checkpoint.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
### Python Basics

1. Python uses interpreter to convert the code to machine understandable instructions.
2. Best practice is always to use single quotes in print function in Python
3. In python there cannot be more than one instruction in a line
4. By default, print() function provides new line character at the end by default.

5. In Python, variable names must start with a letter or an underscore sign
6. Variable name cannot start with numbers
7. In Python, from and global cannot be used a variable names.
8. Variable data types: string, integer, float, boolean
9. Boolean value should start with upper case letter - Only True or False are valid booleans
10. In python, comments are started with a hash (#) sign.

11. Beginning python3.6, we can use underscores in numbers: e.g: 2_333_333 == 2333333
12. Decimal Numbers can also be represented in scientific notation (for e.g. 3e4 for 30000.0, 3e-4 for 0.0003) => 3e4 = 3 * 10 pow 4 > 3 *10000
13. In Python, Numbers can also be represented in octal and in hexadecimal format
14. If any number starts with 0O or 0o, then the number is in octal value. After the 0O or 0o, we can give only from 1 to 7 numbers. 8 and 9 are not allowed.
15. Hexadecimal numbers starts with 0X or 0x
16. In Python, the print() function will automatically convert the octal and hex decimal numbers into Numbers

17. `+ (plus), - (minus), * (multiplication), / (division), // (integer division) and % (Modulus division)` are the operators available in Python.
18. `/ (division)` produces float output
19. `// (integer division)` produces the nearest whole integer output instead of having decimals in the number unlike / (division) operator.
20. `% (modulus division)` produces the reminder as output > 3%4 ==> 3; 3 %5 ==> 3; 4%2 ==> 0
21. We can use `+=, -=, *=` as operators: age += 1 (age = age+1)
22. `**` is `the power operator` in Python, e.g: 3 **3 =27, 3*3*3 =27
23. We can multiply a string with number in python (e.g: `test*2` will output `testtest`)
24. Python is an interpreter language, we need an interpreter to converting it to machine code.
25. Python interpreter reads code from top to bottom.
26. Interpreter checks the following while reading the code - Lexis, Syntax and Semantics
27. Java is a compiler language

28. We can use two functions in a single line
29. Typecasting functions: `int(), float(), str()`
30. `input()` function reads any value in string type
31. We required to typecast the `intput(`) output numbers before using it for mathematical calculation purpose.
32. Order of operators:
1. `**`
2. `* / // %`
3. `+ -`
* 1 // 2 * 3 = 0 => first evaluate 1//2 which is 0 and then 0*3 which is 0: Division and multiplication takes equal precedence from left to right.
33. The `BODMAS` rule is a mnemonic for the order of operations in mathematics: Brackets, Orders (powers/roots), Division, Multiplication, Addition, and Subtraction, ensuring correct calculation sequences. Crucially, Division and Multiplication are of equal priority and solved left-to-right.
34. In python, exponentiation operator takes right sided binding, (I.e. it starts from right) > 2**3**2 ==> 2**9 = 512; 3 **2**2 ==> 3**4 =81
35. Keyword Arguments/Named Arguments: e.g: `end=‘.’, sep=‘.’`
36. The default end argument is new line character.
37. The default space argument is space character.


1. Bitwise operations on Python are possible but almost never used.
2. In python, there are 6 bitwise operators (&, |, ^, ~, <<, >>)
3. `~` is logical negation (~x = -x-1) which is logical not > ~1 =-1-1 ==> -2
4. `<<` operator: (left shift)
1. 3 << 1 = 3 * 2 = 6
2. 3 << 2=3*(2*2) = 12
3. 3 << 3=3 * (2*2*2) = 24
5. `>>` operator: (right shift)
1. 12 >> 1 = 12/2 = 6
2. 12>>2 = 12/(2*2)= 3
6. In Python, 2 is equal to 2.0
7. not, and, or are the multiple condition joining operators,
8. These boolean operators has the priority
1. not
2. and
3. or
9. We can use `\` (backslash) to code in multiline in python
1. E.g: (elif not user_age >= 23 and user_country == 'def' or user_country == 'ghi' \
2. or user_country == 'jkl':)
10. In python triple quotes (''') at the start and end of the string in print will allow the string to print in multiple lines
1. print(‘’’ ==============
1. == print==
2. ==============‘’’)
11. Sequence is a type of data structure in python which stores multiple values of same type.
1. E.g: string is a sequence of multiple characters: ‘Hello’ => h, e, l, l, 0
12. The index in for loop is called control variable
1. e.g: for i in ‘hello’ => here `i` is control variable.
2. E.g: for index in range(1, 11): ==> here in the range function, start value 1 is inclusive and the end value 11 is exclusive.
13. break and continue instructions will break and skip the iterations in loop respectively.
14. pass instruction will do nothing in the loop
1. for i in range(11): here the pass will do nothing and for loop will not give any error during runtime, Here range is from 0 to 10 (11 is exclusive)
1. pass
15. In python, while and for loops will have else branch: The else branch of a while/for loop is always executed exactly once except in break, continue and pass statement/instruction scenario.'''

Next: [Python Collections](./python_collections.md)
11 changes: 11 additions & 0 deletions src/main/java/com.naga/Vehicle.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.naga;

public class Vehicle {
public static void main(String[] args) {
System.out.println("No Of wheels : " + noOfWheels("bike"));
}

public static int noOfWheels(String vehicleName) {
return VehicleType.getVehicleType(vehicleName).getNoOfWheels();
}
}
34 changes: 34 additions & 0 deletions src/main/java/com.naga/VehicleType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.naga;

public enum VehicleType {

CAR("car", 4),
AUTO("auto", 3),
BIKE("bike", 2),
NONE("none", 0);

private final String vehicleName;
private final int noOfWheels;

VehicleType(String name, int noOfWheels) {
this.vehicleName = name;
this.noOfWheels = noOfWheels;
}

public String getVehicleName() {
return vehicleName;
}

public int getNoOfWheels() {
return noOfWheels;
}

public static VehicleType getVehicleType(String name) {
for (VehicleType type : VehicleType.values()) {
if (type.vehicleName.equalsIgnoreCase(name)) {
return type;
}
}
return NONE;
}
}