id string | title string | context string | question string | answers list | answer_starts list | is_impossible bool | question_emb list |
|---|---|---|---|---|---|---|---|
56be85543aeaaa14008c9063 | Beyoncé | Beyoncé Giselle Knowles-Carter (/biːˈjɒnseɪ/ bee-YON-say) (born September 4, 1981) is an American singer, songwriter, record producer and actress. Born and raised in Houston, Texas, she performed in various singing and dancing competitions as a child, and rose to fame in the late 1990s as lead singer of R&B girl-group ... | When did Beyonce start becoming popular? | [
"in the late 1990s"
] | [
269
] | false | [
0.033608946949243546,
-0.07656942307949066,
-0.050523724406957626,
0.024370480328798294,
-0.03214146941900253,
0.0017140820855274796,
0.08060161769390106,
0.031048696488142014,
-0.040092598646879196,
0.007601150311529636,
0.01977255754172802,
0.06326141953468323,
0.016630778089165688,
-0.0... |
56be85543aeaaa14008c9065 | Beyoncé | Beyoncé Giselle Knowles-Carter (/biːˈjɒnseɪ/ bee-YON-say) (born September 4, 1981) is an American singer, songwriter, record producer and actress. Born and raised in Houston, Texas, she performed in various singing and dancing competitions as a child, and rose to fame in the late 1990s as lead singer of R&B girl-group ... | What areas did Beyonce compete in when she was growing up? | [
"singing and dancing"
] | [
207
] | false | [
0.08093281835317612,
-0.03647235408425331,
-0.005242346785962582,
0.02323335036635399,
-0.03575758635997772,
0.011807138100266457,
0.05315488204360008,
0.0025829863734543324,
-0.07624224573373795,
0.009575912728905678,
-0.015292457304894924,
-0.0006123670027591288,
0.01114631537348032,
-0.... |
56be85543aeaaa14008c9066 | Beyoncé | Beyoncé Giselle Knowles-Carter (/biːˈjɒnseɪ/ bee-YON-say) (born September 4, 1981) is an American singer, songwriter, record producer and actress. Born and raised in Houston, Texas, she performed in various singing and dancing competitions as a child, and rose to fame in the late 1990s as lead singer of R&B girl-group ... | When did Beyonce leave Destiny's Child and become a solo singer? | [
"2003"
] | [
526
] | false | [
0.024471038952469826,
-0.07047852873802185,
0.0178933534771204,
0.03493007272481918,
0.05634293332695961,
-0.03919327259063721,
0.07815674692392349,
0.01660209149122238,
0.03724389523267746,
-0.007560816127806902,
0.03047100082039833,
0.007981900125741959,
-0.03128255158662796,
-0.06538807... |
56bf6b0f3aeaaa14008c9601 | Beyoncé | Beyoncé Giselle Knowles-Carter (/biːˈjɒnseɪ/ bee-YON-say) (born September 4, 1981) is an American singer, songwriter, record producer and actress. Born and raised in Houston, Texas, she performed in various singing and dancing competitions as a child, and rose to fame in the late 1990s as lead singer of R&B girl-group ... | In what city and state did Beyonce grow up? | [
"Houston, Texas"
] | [
166
] | false | [
0.05537686124444008,
-0.0029899736400693655,
-0.021123459562659264,
0.07321561127901077,
-0.05817098170518875,
-0.01729212887585163,
0.04140685498714447,
-0.02327142283320427,
-0.03426286578178406,
0.04703685641288757,
0.019985554739832878,
0.00306840892881155,
0.006125225219875574,
-0.072... |
56bf6b0f3aeaaa14008c9602 | Beyoncé | Beyoncé Giselle Knowles-Carter (/biːˈjɒnseɪ/ bee-YON-say) (born September 4, 1981) is an American singer, songwriter, record producer and actress. Born and raised in Houston, Texas, she performed in various singing and dancing competitions as a child, and rose to fame in the late 1990s as lead singer of R&B girl-group ... | In which decade did Beyonce become famous? | [
"late 1990s"
] | [
276
] | false | [
0.031171012669801712,
-0.02086903341114521,
-0.047874320298433304,
-0.004480014555156231,
-0.02740858867764473,
0.029293734580278397,
0.09412116557359695,
0.03253839164972305,
-0.04716027155518532,
-0.04230736196041107,
0.014582083560526371,
0.03603731840848923,
0.05820353701710701,
-0.013... |
56bf6b0f3aeaaa14008c9603 | Beyoncé | Beyoncé Giselle Knowles-Carter (/biːˈjɒnseɪ/ bee-YON-say) (born September 4, 1981) is an American singer, songwriter, record producer and actress. Born and raised in Houston, Texas, she performed in various singing and dancing competitions as a child, and rose to fame in the late 1990s as lead singer of R&B girl-group ... | In what R&B group was she the lead singer? | [
"Destiny's Child"
] | [
320
] | false | [
-0.03503004088997841,
-0.12375308573246002,
-0.051020681858062744,
0.040693461894989014,
-0.017723916098475456,
0.10605088621377945,
0.10639559477567673,
0.010872081853449345,
0.011537394486367702,
0.0005517022218555212,
0.017075933516025543,
-0.07987506687641144,
0.052049946039915085,
-0.... |
56bf6b0f3aeaaa14008c9604 | Beyoncé | Beyoncé Giselle Knowles-Carter (/biːˈjɒnseɪ/ bee-YON-say) (born September 4, 1981) is an American singer, songwriter, record producer and actress. Born and raised in Houston, Texas, she performed in various singing and dancing competitions as a child, and rose to fame in the late 1990s as lead singer of R&B girl-group ... | What album made her a worldwide known artist? | [
"Dangerously in Love"
] | [
505
] | false | [
0.030092399567365646,
-0.03931732475757599,
0.0020080781541764736,
0.06773354858160019,
-0.03928424417972565,
0.05692080780863762,
0.0848894864320755,
0.025454677641391754,
-0.0004780453455168754,
0.023700837045907974,
0.029628144577145576,
-0.05886424332857132,
0.022770054638385773,
-0.03... |
56bf6b0f3aeaaa14008c9605 | Beyoncé | Beyoncé Giselle Knowles-Carter (/biːˈjɒnseɪ/ bee-YON-say) (born September 4, 1981) is an American singer, songwriter, record producer and actress. Born and raised in Houston, Texas, she performed in various singing and dancing competitions as a child, and rose to fame in the late 1990s as lead singer of R&B girl-group ... | Who managed the Destiny's Child group? | [
"Mathew Knowles"
] | [
360
] | false | [
-0.007762295193970203,
-0.02854909934103489,
0.037145934998989105,
0.03772130236029625,
0.07026245445013046,
-0.03810188174247742,
0.047626346349716187,
-0.031045615673065186,
0.03725646808743477,
0.054204411804676056,
0.029362047091126442,
0.010230560787022114,
-0.008701060898602009,
-0.0... |
56d43c5f2ccc5a1400d830a9 | Beyoncé | Beyoncé Giselle Knowles-Carter (/biːˈjɒnseɪ/ bee-YON-say) (born September 4, 1981) is an American singer, songwriter, record producer and actress. Born and raised in Houston, Texas, she performed in various singing and dancing competitions as a child, and rose to fame in the late 1990s as lead singer of R&B girl-group ... | When did Beyoncé rise to fame? | [
"late 1990s"
] | [
276
] | false | [
-0.005327921826392412,
-0.05524301528930664,
-0.057537440210580826,
0.034142009913921356,
-0.030424833297729492,
0.029416032135486603,
0.08878323435783386,
0.046664655208587646,
-0.01999019831418991,
-0.02220291830599308,
0.013714060187339783,
0.04119917005300522,
0.031200524419546127,
-0.... |
56d43c5f2ccc5a1400d830aa | Beyoncé | Beyoncé Giselle Knowles-Carter (/biːˈjɒnseɪ/ bee-YON-say) (born September 4, 1981) is an American singer, songwriter, record producer and actress. Born and raised in Houston, Texas, she performed in various singing and dancing competitions as a child, and rose to fame in the late 1990s as lead singer of R&B girl-group ... | What role did Beyoncé have in Destiny's Child? | [
"lead singer"
] | [
290
] | false | [
-0.00137643504422158,
0.0001638966059545055,
-0.002789510181173682,
0.02172745019197464,
0.0009754644124768674,
-0.029284890741109848,
0.11418554931879044,
0.021445676684379578,
0.051518023014068604,
0.014487335458397865,
0.009204231202602386,
-0.0042112842202186584,
-0.06398984044790268,
... |
56d43c5f2ccc5a1400d830ab | Beyoncé | Beyoncé Giselle Knowles-Carter (/biːˈjɒnseɪ/ bee-YON-say) (born September 4, 1981) is an American singer, songwriter, record producer and actress. Born and raised in Houston, Texas, she performed in various singing and dancing competitions as a child, and rose to fame in the late 1990s as lead singer of R&B girl-group ... | What was the first album Beyoncé released as a solo artist? | [
"Dangerously in Love"
] | [
505
] | false | [
-0.0013864474603906274,
-0.04240413382649422,
-0.051280610263347626,
0.06809459626674652,
-0.05864190682768822,
-0.04782944917678833,
0.12341148406267166,
0.014445468783378601,
0.021396204829216003,
-0.03576916828751564,
0.04482775554060936,
-0.018756747245788574,
0.05336430296301842,
-0.0... |
56d43c5f2ccc5a1400d830ac | Beyoncé | Beyoncé Giselle Knowles-Carter (/biːˈjɒnseɪ/ bee-YON-say) (born September 4, 1981) is an American singer, songwriter, record producer and actress. Born and raised in Houston, Texas, she performed in various singing and dancing competitions as a child, and rose to fame in the late 1990s as lead singer of R&B girl-group ... | When did Beyoncé release Dangerously in Love? | [
"2003"
] | [
526
] | false | [
-0.04160024970769882,
-0.005441741552203894,
-0.0019274639198556542,
0.05821854993700981,
0.015845870599150658,
0.0236684437841177,
0.04749467223882675,
0.05785389989614487,
0.04871030151844025,
-0.0009677977650426328,
0.015172146260738373,
-0.008597424253821373,
0.0031729857437312603,
-0.... |
56d43c5f2ccc5a1400d830ad | Beyoncé | Beyoncé Giselle Knowles-Carter (/biːˈjɒnseɪ/ bee-YON-say) (born September 4, 1981) is an American singer, songwriter, record producer and actress. Born and raised in Houston, Texas, she performed in various singing and dancing competitions as a child, and rose to fame in the late 1990s as lead singer of R&B girl-group ... | How many Grammy awards did Beyoncé win for her first solo album? | [
"five"
] | [
590
] | false | [
-0.011933302506804466,
-0.04028606787323952,
-0.054966047406196594,
0.021228643134236336,
-0.07960892468690872,
0.009283386170864105,
0.10679740458726883,
0.04403577744960785,
0.009222578257322311,
-0.04296698048710823,
-0.016515539959073067,
-0.059420421719551086,
0.052326519042253494,
-0... |
56d43ce42ccc5a1400d830b4 | Beyoncé | Beyoncé Giselle Knowles-Carter (/biːˈjɒnseɪ/ bee-YON-say) (born September 4, 1981) is an American singer, songwriter, record producer and actress. Born and raised in Houston, Texas, she performed in various singing and dancing competitions as a child, and rose to fame in the late 1990s as lead singer of R&B girl-group ... | What was Beyoncé's role in Destiny's Child? | [
"lead singer"
] | [
290
] | false | [
-0.007426164112985134,
-0.001796041615307331,
0.000601856445427984,
0.021206367760896683,
0.013577498495578766,
-0.03294401615858078,
0.11680439114570618,
0.00915694609284401,
0.04548354819417,
0.009630231186747551,
0.0012333727208897471,
-0.0017278550658375025,
-0.06844767183065414,
-0.04... |
56d43ce42ccc5a1400d830b5 | Beyoncé | Beyoncé Giselle Knowles-Carter (/biːˈjɒnseɪ/ bee-YON-say) (born September 4, 1981) is an American singer, songwriter, record producer and actress. Born and raised in Houston, Texas, she performed in various singing and dancing competitions as a child, and rose to fame in the late 1990s as lead singer of R&B girl-group ... | What was the name of Beyoncé's first solo album? | [
"Dangerously in Love"
] | [
505
] | false | [
-0.019130971282720566,
-0.048405151814222336,
-0.02994569018483162,
0.05695654824376106,
-0.06480617076158524,
-0.060625769197940826,
0.13065467774868011,
0.018182801082730293,
0.03090566396713257,
-0.06303323060274124,
0.03390907123684883,
-0.039663854986429214,
0.05002666637301445,
-0.09... |
56be86cf3aeaaa14008c9076 | Beyoncé | Following the disbandment of Destiny's Child in June 2005, she released her second solo album, B'Day (2006), which contained hits "Déjà Vu", "Irreplaceable", and "Beautiful Liar". Beyoncé also ventured into acting, with a Golden Globe-nominated performance in Dreamgirls (2006), and starring roles in The Pink Panther (2... | After her second solo album, what other entertainment venture did Beyonce explore? | [
"acting"
] | [
207
] | false | [
0.06253314018249512,
-0.12702500820159912,
-0.013893553987145424,
0.02400335483253002,
-0.03483857214450836,
-0.024939103052020073,
0.11580778658390045,
0.01035759225487709,
0.019733594730496407,
-0.018864843994379044,
0.04296329617500305,
-0.03704146668314934,
0.021889474242925644,
-0.041... |
56be86cf3aeaaa14008c9078 | Beyoncé | Following the disbandment of Destiny's Child in June 2005, she released her second solo album, B'Day (2006), which contained hits "Déjà Vu", "Irreplaceable", and "Beautiful Liar". Beyoncé also ventured into acting, with a Golden Globe-nominated performance in Dreamgirls (2006), and starring roles in The Pink Panther (2... | Which artist did Beyonce marry? | [
"Jay Z"
] | [
369
] | false | [
-0.022289838641881943,
-0.01387841533869505,
-0.018621716648340225,
0.03652447462081909,
-0.0826520323753357,
-0.022330913692712784,
0.1347116231918335,
-0.002249382436275482,
0.06289942562580109,
-0.020769717171788216,
-0.048636991530656815,
-0.0030096760019659996,
0.02614026516675949,
-0... |
56be86cf3aeaaa14008c9079 | Beyoncé | Following the disbandment of Destiny's Child in June 2005, she released her second solo album, B'Day (2006), which contained hits "Déjà Vu", "Irreplaceable", and "Beautiful Liar". Beyoncé also ventured into acting, with a Golden Globe-nominated performance in Dreamgirls (2006), and starring roles in The Pink Panther (2... | To set the record for Grammys, how many did Beyonce win? | [
"six"
] | [
565
] | false | [
-0.005589926149696112,
-0.01811714842915535,
-0.03215710446238518,
-0.019733205437660217,
-0.0908193290233612,
0.026373691856861115,
0.09165201336145401,
0.05219035595655441,
-0.006909893825650215,
-0.02582068368792534,
-0.04735086113214493,
-0.03710729628801346,
0.053709447383880615,
-0.0... |
56bf6e823aeaaa14008c9627 | Beyoncé | Following the disbandment of Destiny's Child in June 2005, she released her second solo album, B'Day (2006), which contained hits "Déjà Vu", "Irreplaceable", and "Beautiful Liar". Beyoncé also ventured into acting, with a Golden Globe-nominated performance in Dreamgirls (2006), and starring roles in The Pink Panther (2... | For what movie did Beyonce receive her first Golden Globe nomination? | [
"Dreamgirls"
] | [
260
] | false | [
-0.03690265491604805,
-0.05931095778942108,
-0.048435840755701065,
0.04504651576280594,
-0.02300036884844303,
0.02335786633193493,
0.11542956531047821,
0.02995661087334156,
0.043631311506032944,
-0.06129518523812294,
-0.02659921906888485,
0.04804523289203644,
-0.004046909045428038,
0.03136... |
56bf6e823aeaaa14008c9629 | Beyoncé | Following the disbandment of Destiny's Child in June 2005, she released her second solo album, B'Day (2006), which contained hits "Déjà Vu", "Irreplaceable", and "Beautiful Liar". Beyoncé also ventured into acting, with a Golden Globe-nominated performance in Dreamgirls (2006), and starring roles in The Pink Panther (2... | When did Beyonce take a hiatus in her career and take control of her management? | [
"2010"
] | [
586
] | false | [
0.02767670899629593,
-0.07965043187141418,
-0.012854418717324734,
0.08263187110424042,
-0.010726267471909523,
-0.001753364223986864,
0.04638493433594704,
0.0022607222199440002,
-0.02079949900507927,
-0.017196008935570717,
0.017475740984082222,
0.08550957590341568,
-0.02310805395245552,
-0.... |
56bf6e823aeaaa14008c962a | Beyoncé | Following the disbandment of Destiny's Child in June 2005, she released her second solo album, B'Day (2006), which contained hits "Déjà Vu", "Irreplaceable", and "Beautiful Liar". Beyoncé also ventured into acting, with a Golden Globe-nominated performance in Dreamgirls (2006), and starring roles in The Pink Panther (2... | Which album was darker in tone from her previous work? | [
"Beyoncé"
] | [
180
] | false | [
0.00393200246617198,
-0.0573638379573822,
0.0055107795633375645,
0.04111998528242111,
-0.04755399748682976,
0.018222354352474213,
0.05883418023586273,
0.021088724955916405,
0.026962658390402794,
-0.04583192989230156,
0.025906817987561226,
-0.02955208159983158,
0.008408223278820515,
-0.0974... |
SQuAD v2 (Lance Format)
A Lance-formatted version of SQuAD v2 — the Stanford Question Answering Dataset with both answerable and deliberately unanswerable questions over Wikipedia passages — with MiniLM question embeddings stored inline and ready for retrieval at hf://datasets/lance-format/squad-v2-lance/data.
Key features
- Span-extraction QA over Wikipedia with 130k+ training questions and an
is_impossibleflag that cleanly separates answerable from unanswerable items. - Pre-computed 384-dim question embeddings (
question_emb,sentence-transformers/all-MiniLM-L6-v2, cosine-normalized) with a bundledIVF_PQindex for semantic question retrieval. - Full-text inverted indices on both
questionandcontextfor keyword search alongside dense retrieval. - One columnar dataset carrying questions, contexts, answer spans, and embeddings together — project only the columns each query needs.
Splits
| Split | Rows |
|---|---|
train.lance |
130,319 |
validation.lance |
11,873 |
Schema
| Column | Type | Notes |
|---|---|---|
id |
string |
SQuAD question id (natural join key for merges) |
title |
string |
Wikipedia article title |
context |
string |
Paragraph the question was generated from |
question |
string |
The question text |
answers |
list<string> |
Accepted answer spans (empty for impossible questions) |
answer_starts |
list<int32> |
Character offsets of each answer within context |
is_impossible |
bool |
true for SQuAD 2.0 unanswerable questions |
question_emb |
fixed_size_list<float32, 384> |
MiniLM embedding of question (cosine-normalized) |
Pre-built indices
IVF_PQonquestion_emb—metric=cosine, vector similarity searchINVERTEDonquestionandcontext— full-text searchBTREEonidandtitle— point lookups and prefix scansBITMAPonis_impossible— fast filtering between answerable and unanswerable
Why Lance?
- Blazing Fast Random Access: Optimized for fetching scattered rows, making it ideal for random sampling, real-time ML serving, and interactive applications without performance degradation.
- Native Multimodal Support: Store text, embeddings, and other data types together in a single file. Large binary objects are loaded lazily, and vectors are optimized for fast similarity search.
- Native Index Support: Lance comes with fast, on-disk, scalable vector and FTS indexes that sit right alongside the dataset on the Hub, so you can share not only your data but also your embeddings and indexes without your users needing to recompute them.
- Efficient Data Evolution: Add new columns and backfill data without rewriting the entire dataset. This is perfect for evolving ML features, adding new embeddings, or introducing moderation tags over time.
- Versatile Querying: Supports combining vector similarity search, full-text search, and SQL-style filtering in a single query, accelerated by on-disk indexes.
- Data Versioning: Every mutation commits a new version; previous versions remain intact on disk. Tags pin a snapshot by name, so retrieval systems and training runs can reproduce against an exact slice of history.
Load with datasets.load_dataset
You can load Lance datasets via the standard HuggingFace datasets interface, suitable when your pipeline already speaks Dataset / IterableDataset or you want a quick streaming sample.
import datasets
hf_ds = datasets.load_dataset("lance-format/squad-v2-lance", split="validation", streaming=True)
for row in hf_ds.take(3):
print(row["question"], "->", row["answers"])
Load with LanceDB
LanceDB is the embedded retrieval library built on top of the Lance format (docs), and is the interface most users interact with. It wraps the dataset as a queryable table with search and filter builders, and is the entry point used by the Search, Curate, Evolve, Versioning, and Materialize-a-subset sections below.
import lancedb
db = lancedb.connect("hf://datasets/lance-format/squad-v2-lance/data")
tbl = db.open_table("train")
print(len(tbl))
Load with Lance
pylance is the Python binding for the Lance format and works directly with the format's lower-level APIs. Reach for it when you want to inspect dataset internals — schema, scanner, fragments, the list of pre-built indices.
import lance
ds = lance.dataset("hf://datasets/lance-format/squad-v2-lance/data/train.lance")
print(ds.count_rows(), ds.schema.names)
print(ds.list_indices())
Tip — for production use, download locally first. Streaming from the Hub works for exploration, but heavy random access and ANN search are far faster against a local copy:
hf download lance-format/squad-v2-lance --repo-type dataset --local-dir ./squad-v2-lanceThen point Lance or LanceDB at
./squad-v2-lance/data.
Search
The bundled IVF_PQ index on question_emb turns semantic question retrieval into a single call. In production you would encode an incoming question through the same MiniLM encoder used at ingest and pass the resulting 384-dim vector to tbl.search(...). The example below uses the embedding from row 42 as a runnable stand-in, then restricts the result to answerable items so the response always carries a usable span.
import lancedb
db = lancedb.connect("hf://datasets/lance-format/squad-v2-lance/data")
tbl = db.open_table("train")
seed = (
tbl.search()
.select(["question_emb", "question"])
.limit(1)
.offset(42)
.to_list()[0]
)
hits = (
tbl.search(seed["question_emb"], vector_column_name="question_emb")
.metric("cosine")
.where("is_impossible = false", prefilter=True)
.select(["id", "title", "question", "answers"])
.limit(10)
.to_list()
)
for r in hits:
print(f"{r['title']:30s} | {r['question'][:80]}")
Because the recommended setup also builds an INVERTED index on both question and context, the same query can be issued as a hybrid search that combines the dense vector with a keyword query. LanceDB merges and reranks the two result lists in a single call, which is useful when a literal phrase must appear in the passage but the dense side should still drive ranking.
hybrid_hits = (
tbl.search(query_type="hybrid")
.vector(seed["question_emb"])
.text("eiffel tower")
.where("is_impossible = false", prefilter=True)
.select(["id", "title", "question", "context", "answers"])
.limit(10)
.to_list()
)
for r in hybrid_hits:
print(f"{r['title']:30s} | {r['question'][:80]}")
Tune metric, nprobes, and refine_factor on the vector side to trade recall against latency.
Curate
SQuAD v2 has a natural split between answerable and unanswerable questions, and the is_impossible boolean — backed by a BITMAP index — makes either subset cheap to extract. Stacking predicates inside a single filtered scan keeps the result small and explicit, and the bounded .limit(1000) makes it easy to inspect or hand off.
import lancedb
db = lancedb.connect("hf://datasets/lance-format/squad-v2-lance/data")
tbl = db.open_table("train")
impossible = (
tbl.search()
.where("is_impossible = true AND length(question) >= 40", prefilter=True)
.select(["id", "title", "question", "context"])
.limit(1000)
.to_list()
)
print(f"{len(impossible)} hard unanswerable questions; first title: {impossible[0]['title']}")
The mirror query — long, well-grounded answerable questions — looks identical with the boolean flipped, and the question_emb vector is never read by either scan. The result is a plain list of dictionaries, ready to inspect, persist as a manifest of question ids, or hand to the Materialize-a-subset section below for export to a writable local copy.
Evolve
Lance stores each column independently, so a new column can be appended without rewriting the existing data. The lightest form is a SQL expression: derive the new column from columns that already exist, and Lance computes it once and persists it. The example below adds a question_length, a num_answers count, and a has_answer flag — any of which can then be used directly in where clauses without recomputing the predicate on every query.
Note: Mutations require a local copy of the dataset, since the Hub mount is read-only. See the Materialize-a-subset section at the end of this card for a streaming pattern that downloads only the rows and columns you need, or use
hf downloadto pull the full corpus.
import lancedb
db = lancedb.connect("./squad-v2-lance/data") # local copy required for writes
tbl = db.open_table("train")
tbl.add_columns({
"question_length": "length(question)",
"num_answers": "array_length(answers)",
"has_answer": "NOT is_impossible",
})
If the values you want to attach already live in another table (offline reader-model predictions, alternate embeddings, span-level labels), merge them in by joining on id:
import pyarrow as pa
scores = pa.table({
"id": pa.array(["56be4db0acb8001400a502ec", "56be4db0acb8001400a502ed"]),
"reader_score": pa.array([0.91, 0.42]),
})
tbl.merge(scores, on="id")
The original columns and indices are untouched, so existing code that does not reference the new columns continues to work unchanged. New columns become visible to every reader as soon as the operation commits. For column values that require a Python computation (e.g., running a different embedding model over the questions), Lance provides a batch-UDF API — see the Lance data evolution docs.
Train
Projection lets a training loop read only the columns each step actually needs. LanceDB tables expose this through Permutation.identity(tbl).select_columns([...]), which plugs straight into the standard torch.utils.data.DataLoader so prefetching, shuffling, and batching behave as in any PyTorch pipeline. For a reading-comprehension model the natural projection is the question, the context, and the answer spans together; for a retriever or reranker on top of frozen features, project the precomputed embedding instead.
import lancedb
from lancedb.permutation import Permutation
from torch.utils.data import DataLoader
db = lancedb.connect("hf://datasets/lance-format/squad-v2-lance/data")
tbl = db.open_table("train")
train_ds = Permutation.identity(tbl).select_columns(
["question", "context", "answers", "answer_starts", "is_impossible"]
)
loader = DataLoader(train_ds, batch_size=32, shuffle=True, num_workers=4)
for batch in loader:
# batch carries only the projected columns; question_emb stays on disk.
# tokenize question+context, build span labels from answer_starts, forward, backward...
...
Switching feature sets is a configuration change: passing ["question_emb"] (optionally with ["answers"] for hard-negative mining) to select_columns(...) on the next run reads only the 384-d vectors and skips the bulky context strings entirely, which is the right shape for training a retrieval head or reranker on cached embeddings. Columns added in Evolve cost nothing per batch until they are explicitly projected.
Versioning
Every mutation to a Lance dataset, whether it adds a column, merges labels, or builds an index, commits a new version. Previous versions remain intact on disk. You can list versions and inspect the history directly from the Hub copy; creating new tags requires a local copy since tags are writes.
import lancedb
db = lancedb.connect("hf://datasets/lance-format/squad-v2-lance/data")
tbl = db.open_table("train")
print("Current version:", tbl.version)
print("History:", tbl.list_versions())
print("Tags:", tbl.tags.list())
Once you have a local copy, tag a version for reproducibility:
local_db = lancedb.connect("./squad-v2-lance/data")
local_tbl = local_db.open_table("train")
local_tbl.tags.create("baseline-v1", local_tbl.version)
A tagged version can be opened by name, or any version reopened by its number, against either the Hub copy or a local one:
tbl_v1 = db.open_table("train", version="baseline-v1")
tbl_v5 = db.open_table("train", version=5)
Pinning supports two workflows. A retrieval system locked to baseline-v1 keeps returning stable results while the dataset evolves in parallel — newly added reader scores or labels do not change what the tag resolves to. A training experiment pinned to the same tag can be rerun later against the exact same questions and contexts, so changes in metrics reflect model changes rather than data drift. Neither workflow needs shadow copies or external manifest tracking.
Materialize a subset
Reads from the Hub are lazy, so exploratory queries only transfer the columns and row groups they touch. Mutating operations (Evolve, tag creation) need a writable backing store, and a training loop benefits from a local copy with fast random access. Both can be served by a subset of the dataset rather than the full corpus. The pattern is to stream a filtered query through .to_batches() into a new local table; only the projected columns and matching row groups cross the wire, and the bytes never fully materialize in Python memory.
import lancedb
remote_db = lancedb.connect("hf://datasets/lance-format/squad-v2-lance/data")
remote_tbl = remote_db.open_table("train")
batches = (
remote_tbl.search()
.where("is_impossible = false AND length(question) >= 30")
.select(["id", "title", "context", "question", "answers", "answer_starts", "question_emb"])
.to_batches()
)
local_db = lancedb.connect("./squad-v2-answerable")
local_db.create_table("train", batches)
The resulting ./squad-v2-answerable is a first-class LanceDB database. Every snippet in the Search, Evolve, Train, and Versioning sections above works against it by swapping hf://datasets/lance-format/squad-v2-lance/data for ./squad-v2-answerable.
Source & license
Converted from rajpurkar/squad_v2. SQuAD v2 is distributed under CC BY-SA 4.0.
Citation
@article{rajpurkar2018know,
title={Know What You Don't Know: Unanswerable Questions for SQuAD},
author={Rajpurkar, Pranav and Jia, Robin and Liang, Percy},
journal={Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Short Papers)},
year={2018}
}
- Downloads last month
- 178