How does self-attention differ from cross-attention?
Simple meaning
Self-attention uses queries, keys, and values from the same sequence.
Open the full page for Why, Steps, Example and Key takeaway.
Panel-ready GenAI / LLM questions for freshers and experienced developers. Practice at Coding Cadre in Faridabad, or Online from Delhi NCR.
Self-attention uses queries, keys, and values from the same sequence.
Open the full page for Why, Steps, Example and Key takeaway.
Every token attends to every other token, so scores scale as n times n.
Open the full page for Why, Steps, Example and Key takeaway.
During decoding, keys and values for past tokens are reused instead of recomputed.
Open the full page for Why, Steps, Example and Key takeaway.
BERT sees tokens on both sides of a masked position, which helps disambiguation for NLU.
Open the full page for Why, Steps, Example and Key takeaway.
Masked LM hides random tokens and reconstructs them from the full sentence.
Open the full page for Why, Steps, Example and Key takeaway.
State the role, allowed tools, output schema, and what to do when information is missing.
Open the full page for Why, Steps, Example and Key takeaway.
Prompts are code.
Open the full page for Why, Steps, Example and Key takeaway.
ReAct interleaves reasoning traces with actions such as search or calculator calls.
Open the full page for Why, Steps, Example and Key takeaway.
You constrain the model to emit valid JSON or schema-shaped text.
Open the full page for Why, Steps, Example and Key takeaway.
The query may be rewritten, then hybrid search returns top chunks, optionally reranked.
Open the full page for Why, Steps, Example and Key takeaway.
Query rewriting uses an LLM or rules to expand, correct, or split the user question into better search strings.
Open the full page for Why, Steps, Example and Key takeaway.
A reranker scores the first-stage hits more carefully, often with a cross-encoder.
Open the full page for Why, Steps, Example and Key takeaway.
HyDE generates a hypothetical answer, embeds that, and searches with the hypothetical embedding.
Open the full page for Why, Steps, Example and Key takeaway.
You generate several paraphrased queries, retrieve for each, and merge unique chunks.
Open the full page for Why, Steps, Example and Key takeaway.
Retrieval can miss the right chunk, return conflicting sources, or pack so much text that the model ignores the key sentence.
Open the full page for Why, Steps, Example and Key takeaway.
Re-embed changed chunks, upsert by stable IDs, and delete vectors for removed content.
Open the full page for Why, Steps, Example and Key takeaway.
You restrict candidates by tenant, date, product, or ACL before or during ANN search.
Open the full page for Why, Steps, Example and Key takeaway.
HNSW is a graph index with strong recall and simple incremental inserts, at higher memory cost.
Open the full page for Why, Steps, Example and Key takeaway.
Cosine cares about angle, L2 about Euclidean distance, inner product about both direction and magnitude.
Open the full page for Why, Steps, Example and Key takeaway.
Providing relevant passages and requiring citations reduces unsupported claims.
Open the full page for Why, Steps, Example and Key takeaway.